Multiple SceneManagers no Device

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Dr_Asik
Posts: 18
Joined: Wed Jun 02, 2010 2:15 am

Multiple SceneManagers no Device

Post by Dr_Asik »

I am coding the server for my game. It must support several games running in parallel. I figured out each game should have its own SceneManager. I cannot have a video device for each game, nor do I want any, the server doesn't need to render anything.

However the only way I see to get a sceneManager is through device.GetSceneManger(). So do I absolutely need to initialize a video device and how do I get multiple SceneManagers? Is there anything wrong with my approach or pitfalls I should be aware of?

Thanks a lot.
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

You always need a device. However, you don't need to render anything in your main loop.

You can create multiple SceneManagers like this:

Code: Select all

smgr->createNewSceneManager(...)
Never take advice from someone who likes to give advice, so take my advice and don't take it.
macron12388
Posts: 126
Joined: Wed Sep 29, 2010 8:23 pm

Post by macron12388 »

I thought Irrlicht was purely a graphics rendering engine...
I think I understand what it is you are saying, couldn't you use a service other than Irrlicht to keep the games running? I mean if there is no actual 3d rendering (which is the only thing Irrlicht does) then I don't see why it should be running for those other games your server is hosting. :D

Someone should write something like Blender, only it uses Irrlicht instead of blenders Sssslllooooww rendering engine, and is integrated with a whole bunch of goodies, like IrrBP, for physics and such. Then they could make it nice and cool to use with a UI, which would in itself have an IDE set up. Ha, I just described my dream workstation!
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Re: Multiple SceneManagers no Device

Post by slavik262 »

Dr_Asik wrote:I am coding the server for my game. It must support several games running in parallel. I figured out each game should have its own SceneManager. I cannot have a video device for each game, nor do I want any, the server doesn't need to render anything.

However the only way I see to get a sceneManager is through device.GetSceneManger(). So do I absolutely need to initialize a video device and how do I get multiple SceneManagers? Is there anything wrong with my approach or pitfalls I should be aware of?

Thanks a lot.
  • If you're making a dedicated server, there should only be one game state, i.e., one version of what is going on inside the game. The server should work with the clients to try to keep the clients synced with this master state. You should read up on server-client networking for games.
  • If you want to use a scene graph structure to maintain the server's state, you should probably implement your own or modify the Irrlicht scene manager, since it's designed in a lot of ways to work with graphics.
Dr_Asik
Posts: 18
Joined: Wed Jun 02, 2010 2:15 am

Post by Dr_Asik »

Thanks for the constructive comments. My server will be able to host multiple games simultaneously. This is why it needs to hold several different game states, and thus several SceneManagers.

The reason for using Irrlicht despite not having any rendering to do, is that the clients are coded using Irrlicht, and Irrlicht will be used not only for rendering but also for game logic like collision detection. I want the same collision detection to happen on the server. I figure it is more simple that way than code custom collision detection on the server while having Irrlicht do it client-side.

Even though I understand Irrlicht is primarily a rendering engine, I don't see any problem using it just to maintain the game state, although I have little experience with it. Slavik you suggest I should modify the Irrlicht scene manager, why is that, can you give any precise example?

Thanks again.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

The scene manager basically just manages a tree (look up the data structure if you're not familiar with it) of scene nodes. If the server isn't doing any rendering, a lot of the functionality of scene nodes and the scene manager (such as OnRegisterSceneNode, drawAll, etc.) aren't useful to you. Really, you just need to keep track of the transforms and other non-rendering information. Depending on what you need to do, I'd either strip out the rendering code or create your own SceneManager implementation.
Post Reply