I have been working on an orbit sim in processing and want to export it. The game runs perfectly fine from the IDE, but on export it will not run properly. It will open and start, but freeze once images/sprites are displayed.
I have made sure that all assets/data are in the export folder, so it is not an issue related to that. What is interesting is that the application will run perfectly if it is in the sketch folder. It is not because of the files in this folder, I can remove all the sketch files and the application will still run perfectly. As long as the application is in the sketch folder that Processing created, it works as expected. If it is moved anywhere else, it won’t.
The issue also only seems to happen with P2D. If I change the game to use the default renderer and export it, the application will run as expected (albeit poorly). I can’t say I understand the export process, so I am at a loss for what is going on here
Thanks for the reply, but I think that may be a different problem than what I am having here.
As I understand it, the exported application should be independent of Processing (i.e. I can share the exe with those without Processing installed and it should run as expected). So in my case I am confused as to why the exe will only work in the sketch folder, even as I’ve made sure it has all the assets it needs to stand alone.
Did you try to start it with a batch file?
In win, it seems you need to have the folder set
Okay, I see. I tried starting it with a batch file following mnse’s instructions, but it does not make a difference. I followed this format for the bat file:
cd /D <path_to_MySketch.exe>
I guess it is still not properly setting the folder. But even if it does work, how would this effect my ability to distribute it? Would anyone I share the application with have to make a bat file to run it properly?
This seems like a related issue
I’ve done some further testing, and I have noticed that all I have to do is change the name of the exported folder and the application won’t work anymore. So if I do the following:
- export application, which creates a folder named “windows-amd64” in the sketch folder
- change the folder name from “windows-amd64” to anything else, say “spacegame”, the application will no longer work.
So it seems the exe only works properly if its directory is the exact same as when/where it was created.
would you please show, which resources (images,etc) do you load in your sketch and how you reference this resources. Your problems sounds to me that the sketch do not find it when you start the executable from other locations ?
I’ve tested a simple sketch on my side with latest processing version and even I renamed the exe folder to ie. test it runs …
Which parameter do you use when exporting the sketch ?
All the images are loaded in setup(), and the block looks like this:
rocketImg = loadImage("rocket.png");
earthImg = loadImage("earth.png");
moonImg = loadImage("moon.png");
skyImg = loadImage("sky.png");
HUD = loadImage("HUD.png");
highButton = loadImage("highButton.png");
lowButton = loadImage("lowButton.png");
menuImg = loadImage("menu.png");
menuClickedImg = loadImage("menuClicked.png");
exhaust = loadImage("exhaust.png");
engineSound = new SoundFile(this,"Liquid_Light-Low.wav");
font = loadFont("Mercury-20.vlw");
arialFont = loadFont("Arial-Black-20.vlw");
All these assets are in the data folder. When exporting, I am using the default settings. So it is exported for Windows 64 bit, and java is embedded.
Is there a way to get an error log, or some kind of feedback from the application to help see what is happening?
After more testing, it seems that the exported application will work eventually. At first I thought it was completely freezing, but after waiting around 30 seconds or so the game will start. It’s performance is notably worse than if it were in the sketch folder.
So all the assets are being loaded, but for some reason it takes much longer to do so and the performance is much worse.
I’ve found the issue. Changing the folder name or moving the executable to a different location causes it to be run with integrated graphics. If I go and manually set it to be run with my dedicated graphics card it loads and runs as expected.
I wouldn’t have expected such a long loading time on integrated graphics. I am working with large images, so maybe it takes a long time to make the mipmaps during setup()?