Seperating server and client in exe
Hey Just having a question about how to seperate the server and client code in the game. Right now, I am looking at making a flag to the exe that say's it would run in server mode. This require me to create a seperate prosess where the server can run. Is this a smart way to do it? Also if anyone got some good hints to create server code and game code in the same exe without to much hassle. (like writing much diffrent code and using lots of spesial condition code) Thats seems to be all :D
- Me
If you use blocking sockets u'll just have more threads in the same application...
Try to make them work as a seperate programs first so you are sure they can work independant, then you should have no problem moving them into the same application.
Try to make them work as a seperate programs first so you are sure they can work independant, then you should have no problem moving them into the same application.
When testing, it's very useful to run the server and the client in the same process (so you can single-step through an entire exchange, if necessary). It may even be useful to run the server and the client in the same thread, using an event queue of some sort, and select() on sockets; again for debugging purposes.
When deploying, it's useful if the player who hosts the game (assuming it's not an MMO type game) can choose to "host" from within the game itself, so you may wish to retain the server and client behavior within the same process.
To structure the separation of the server vs the client code, you may want to follow something like the execution environment pattern.
When deploying, it's useful if the player who hosts the game (assuming it's not an MMO type game) can choose to "host" from within the game itself, so you may wish to retain the server and client behavior within the same process.
To structure the separation of the server vs the client code, you may want to follow something like the execution environment pattern.
enum Bool { True, False, FileNotFound };
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement