Alpha Game: Vortex The Pretty

It’s my pleasure; I’m glad that you got it working. :slight_smile:

1 Like

So, I have everything in place, but when I develop the game into a app file to try, it instantly crashes, however, when I check package contents of the app file and run the terminal file it runs fine.

Remembering the last issues with this, “running the terminal exe” not only displays useful debugging information but it bases the virtual file system for non panda3d files to whatever the terminal is directed at which my case is the user account’s folder.

I notice two folders named “TesterDefaultProfiles” and “TesterUserProfiles” are created, this of course in a freeze environment (which is the package within the app file) you cannot write, so I,m guessing the keyMapper is trying the create those folders within that freeze environment, and failing thus crashing.

do you know what I have to edit in your code to prevent from writing those folders?

Ah, I’m afraid that I don’t think that I’ve ever used a “freeze” environment–I use Panda’s deployment system. (Unless this is a Mac thing, in which case I don’t really use Mac.) I’m afraid that I’m not in a position to help there. :/

I suppose that you could look for the sections of code that create and look for those directories, and just comment them out. But if you intend to have user key-bindings be retained between runs of the game then you’re presumably going to want to be able to write to a file on the user’s hard-drive anyway…

Hmm, interesting predicament, I mean this will eventually get to me in the future if I avoid it now as I want to eventually implement saving into the game, I have a question, do you know what lines are responsible for the write locations?

I recall solving a frozen environment issue with my “room” files not being located properly with the following code example.

open(str(os.path.join(str(base.mainDir),'room', "room"+str(room)+'.txt')))

I remember something about directory paths being dependent on the operating system format and that the code example above is a “OS” independent format, maybe I,m reaching here, I could attempt to point the write direction to the desktop or documents folder “universally”.

Not offhand, I’m afraid–I’d have to look at the code.

It shouldn’t be difficult to find, I suspect: just look for code that either uses the save-and-load modules (such as the dummy ones that come with KeyMapper), or that uses the “os” module, I think.

That is correct, I believe; I don’t know what format Mac uses, but Linux and Windows use slightly different formats for paths, as I recall.

I can’t speak with confidence to that, I’m afraid. I generally use Panda’s file-handling functionality in an attempt to avoid such worries. ^^;

(It might be worth looking into Panda’s file-handling functionality, if you’re not already doing so–it can be handy, I think!)

I don’t recommend that: some players may very much dislike having a game place files on their desktop or base “documents” folder.

There is a “user data” folder that you can use, I believe, and which can be queried like so:

useDir = Filename.getUserAppdataDirectory().getFullpath()

(Importing Filename first, of course; “Filename” there is Panda’s “Filename” class.)

You might then perhaps create a sub-directory in that folder into which you can place save-files and the like.

Okay, fair enough, maybe mac is more different, I remember with me panda’s virtual file system only handling panda3d format files, it’s why I needed to use the code example I showed you just for non-panda3d files like txt files to be handled in mac os.

I’ll also take a look at your code to see what I can find.

Note that Panda does provide its own version of the Python-standard file-handling functions (“open”, etc.)–see this page.

You can also use the “VirtualFileSystem” the “Filename” classes for general checking of whether a file or folder exists, getting listings of directory contents, and managing OS-specific path-formats, if I recall correctly.

Sorry for the long response, looking at your code at the moment, should I apply this to your code or were you suggesting my code?

Your code–I think that mine should be using such things already for what file-handling there is.

(Unless you’re talking about code imported from the example programs, in which case it might be applicable there.)

Oh, okay, well, I don’t want to risk what already works for me, but I think I remember that page you showed me, maybe I already tried it in the past…

Fair enough; I’ll leave that to your determination.

So what did you mean by.

But if you intend to have user key-bindings be retained between runs of the game then you’re presumably going to want to be able to write to a file on the user’s hard-drive anyway…

From your other post, is there more “temporary” files used to hold the bindings during gameplay? or is it just the folders?

While the game is running, no files are needed to keep the current bindings–it’s just data stored in variables, along with some Panda events and the like.

However, as soon as you close the game, all of that is of course lost. So, if you want the player’s key-bindings to be kept between closing the game and running it again, saving the bindings to a file and then loading them again when the game is restarted seems like a reasonable way of achieving that.

The folders are created in preparation for holding these files, as I recall.

oh, okay, thanks for the clarification, this game is basically demo right now, so there is no need for file saving at the moment, so it may be just the folder creation I,m thinking is causing the crashing.

Come to think of it, does the crash report not indicate what’s causing the crash? There’s usually a stack trace that indicates a specific line, as I recall–but again, I’m not familiar with either Mac or freeze, so perhaps it doesn’t work so under those circumstances.

Well, here is the kicker, when I try to run with terminal it runs fine, it is just when I run it via clicking on the app icon does it crash.

Ah, I see–that’s a pity.

Okay, well, try commenting out the code that attempts to make those directories, and see what happens.

1 Like

will do, when I find the lines that is.

1 Like

Okay, I commented out what I believe creates those folders in the code which are below.

LN:263 succeeded = True #vfs.makeDirectoryFull(self.defaultProfileDirectory)
LN:268 succeeded = True #vfs.makeDirectoryFull(self.userProfileDirectory)
LN:1023 profileFiles = None #vfs.scanDirectory(self.defaultProfileDirectory) + vfs.scanDirectory(self.userProfileDirectory)

So after developing the app file, yes, everything seems to be working now, and that it’s folder creation attempt in the freeze environment was crashing it, hopefully this remains compatible with windows and linux as well, I,m going to develop the other runtimes now and post them in a few.

Fair enough, and I’m glad that you got it working. :slight_smile:

1 Like