I work on a lot of BGE stuff in general, and I often use code. the problem with using code in the BGE is that it is instinctive to use the python while loop, and as you all know, once you run a while loop in the game you’ve just screwed yourself because it will softlock. So I was wondering how I could save it every single time before running the game as a new individual file to avoid this very obnoxious problem. I have lost so much work in the past because of this, and I apologize if I should’ve put it in blender instead.
3: run standalone player so the new blenderplayer.exe crashes and not blender.
when you’re quickly developing something you don’t want to have to rely on the standalone player.
if you cant adapt, then suffer the consequences or find a different engine. but make no mistake, each engine have its own issues you need to work out.
while loops, use controlled
for loops that have a start and end usually.
I do, it is instinctive for any programmer to use while loops and they will indefinitely make that mistake.
And I am adapting by changing my setup to solve this problem.
i dont understand this “instinct” you speak of. coding isnt like muscle memory hotkeys. its hard to imagine anyone who couldnt learn not to type “while” after discovering game code works a bit different then normal scripts.
import bpy bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)
Take these two lines, and run them through a startup script.
laughs in hex
I’m pretty sure there is a setting somewhere which lets you set how many previous versions you want to keep when saving.
So, if you set it to 4, you’d see the following in your directory after a while:
Then, just CRTL+S before you run the game without worrying about losing previous versions.
Use “for” loops instead when you can. They are a LOT harder to accidentally run infinitely and they’re usually easier to read.
what get from this is that not everybody learns from there mistakes, and thus keep repeating them.