Server
Posted: Sun Feb 28, 2016 7:25 pm
Hi all,
What is the most efficient way to make a standalone server for an irrrlicht game?
-Diho
What is the most efficient way to make a standalone server for an irrrlicht game?
-Diho
I considered using even a complete different programming language for the server. But I thought it wasn't such a good idea. Even if I let the client handle all the collision and valid movement checks, don't I still need irrlicht, even without rendering?Sudi wrote:Really depends on what your server has to do. There is no magic answer for this. The server does not even need irrlicht probably since it does not have to display anything.
How should I do calculations with in game objects, without irrlicht? Do you suggest that it's better to write own code for this?Sudi wrote:Well you will have to implement the gamelogic that has to run on the server. But generally it is a bad idea to use irrlicht objects(SceneNodes) as game objects. You can think of it as the rendering component of your gameobjects. But yes if you have collision detection and things like that you will need a physics engine(irrlicht is not a physics engine) running on the server. So a math lib is probably needed. A different language is totally fine for all those things but you probably wanna use c++ as well when it comes to physics.
But beside debugging, how should I disable the rendering part? something like this maybe?CuteAlien wrote:I like to have server/client as similar as possible. Often it's not trivial to figure out which parts of the code should run where. And it becomes easier to move code when server&client run more or less a similar world. So Irrlicht on the server can be fine. For testing you might even render stuff on the server.
For example depending on the game collision might happen on server & client. You have server collisions to ensure you have an instance making the decisions (Han shot first), but you have client collisions to show effects even before the server has decided who get's the points. Generally the server should have as much objects & information to be able to make all decisions that matter.
But it all depends on the game. If you are new to network programming it might help doing first a game which isn't about realtime and fast actions (like shooters). Turn-based games or games at least allowing some lag without affecting the gameplay might be easier (not easy... network never is).
Code: Select all
IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
That should mostly work. Or simply not doing the drawAll calls. It depends on the game what kind of stuff you need on the server. If you do a Poker game you probably don't need any Irrlicht on the server. If you do a Shooter then having a 3D engine on the server is maybe useful. But could also be you only need to run physics on the server (thought even then Irrlicht might be useful to load some mesh-formats).diho wrote:But beside debugging, how should I disable the rendering part? something like this maybe?Will this stop every calculation for rendering purposes?Code: Select all
IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
Own code for what? You know that irrlicht is only a 3d engine+some input. But CuteAlien is right about using irrlicht to load 3d models. It really depends on what you wanna do. Maybe be a bit more specific about what you wanna do? Then we might be able to give you a better answer.diho wrote: How should I do calculations with in game objects, without irrlicht? Do you suggest that it's better to write own code for this?
Yes that works.diho wrote: But beside debugging, how should I disable the rendering part? something like this maybe?Will this stop every calculation for rendering purposes?Code: Select all
IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
The idea is to make a little fps game. The server needs to update player positions to all clients, post-check bullet hits, control AI pathfinding etc. I am planning to use raknet. But as I said, don't I need to use irrlicht to load in the terrain and ingame objects, for at least the pathfinding algorithm if not more?Sudi wrote: Own code for what? You know that irrlicht is only a 3d engine+some input. But CuteAlien is right about using irrlicht to load 3d models. It really depends on what you wanna do. Maybe be a bit more specific about what you wanna do? Then we might be able to give you a better answer.
I don't see how a simplified representation of a terrainnode can work for pathfinding. Could you give a textual example of how you would tackle this? Besides, a physics lib or any lib for that matter has a different way it processes heightmaps to become a terrain mesh or model of some sort. It will be different than the one the client uses (using irrlicht), or do I see this the wrong way?hendu wrote:Usually your physics representation is different from the graphics. You wouldn't use a hugely detailed 3d model with every triangle being a physics triangle, you'd use a box/sphere/ellipse/whatever. Then your server only needs to know the physics world, not the graphics world.
Yeah there is no small fps game. Besides in a case of a fps you can also declare one of the clients as the "server". Then you do not have to run an extra instance.diho wrote: The idea is to make a little fps game. The server needs to update player positions to all clients, post-check bullet hits, control AI pathfinding etc. I am planning to use raknet. But as I said, don't I need to use irrlicht to load in the terrain and ingame objects, for at least the pathfinding algorithm if not more?