Loading...
Logo
Processing Forum
Hello, I am developing a gameserver which has commandline args to show overview or to simply not draw what is happening- how would I prevent PApplet from creating a window at all in this case so I can run it on servers without x installed saving me space and allowing portability. Thanks.

Replies(6)

Just use plain Java?
The reason being I am using libraries which depend on processing library such as fisica. Is there any way to modify the PApplet to not create a window while still running draw and setup? I could modify and rebuild processing if need be, I simply cannot find the code that creates the window. I see PApplet extends Applet which may make this impossible- but is it?

Edit: if not possible is it possible to simple do PApplet.main() to open the new papplet if the commandline arg specifies to draw it?
Well, I am not really understanding your setup. What your game server is supposed to do? Why does it use fisica if it doesn't do graphics?

You guessed, the fact Processing is built around the Java Applet class probably (to my knowledge) limits its usage in headless mode.
Now, indeed, you can change the source or fake PApplet. Or use something not depending on Processing, if all you need is a physics engine without renderer: just go to JBox2D which is independent of renderers (can use any game engine).

Fake PApplet: you can make a simple class with same package, offering the methods fisica expects to find, leaving them empty or using its parameters.
My game server is basically my game except only renders the world basically if a boolean is set on, I'd like to keep this functionality for testing yet be able to turn it off for deployment. The reason I would like it to be fisica is the game uses fisica so when I (re)wrote the server it is basically just a stripped down version of the game. For ease of coding it would be nice to create/transform objects with the same code that is used on the game so I can keep them fairly similar. It is nice to create objects with fairly the same code instead of something quite different which would make futher development harder. The server is well over 5kloc and the game is around 12kloc and so just keeping it bugfree with that is an issue, having a different physics library(I know fisica is just a wrapper) would make it a beast to maintain. Thanks for the suggestion, I will attempt it later tonight.
I am still curious how you would use your headless game server. If you don't mind to share...
Start server over ssh(or at home), login to server with stripped down version of server code(only rendering and request info/send commands) that could issue commands to kick people or change map etc while requesting positions of players- draw map and draw dots where players/vehicles are, be able to read what people are saying to monitor server for cheaters, be able to detect if server crashes and restart if necessary. While still having the ability to simply start a graphical server on your computer and monitor from there.