Running Ogre without a window

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
muppet
Halfling
Posts: 66
Joined: Thu Jan 13, 2005 2:38 pm
Location: UK

Running Ogre without a window

Post by muppet »

Hi all,

I know the title is a bit strange...but...Is there a way to run Ogre without opening a window and rendering things in it? I know that you can simply stop entities from drawing, and just have a black window. However I was wondering if it was possible to stop the window opening at all and have everything run in an 'null'/invisible window (or that sort of thing).

The reason I am asking this is due to the nature of our university games project. Our game is a muliplayer game, which runs from a dedicated server. In this sense we want Ogre to run and update entity positions, animations etc. and then send out these changes to the clients who then render these changes accordingly. However it would be ideal if this was possible without visually running Ogre on the server too.

Thanks
Muppet
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

Sure, just create a RenderSystem_NULL which you just catch all the functions and do nothing (empty functions).
phear hingo

My Webpage
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

You could still use the Ogre classes that don't depend on a RenderSystem without initializing a RenderSystem. That's much nicer than a null plugins, I just detest null plugins, but that's something personal.
User avatar
muppet
Halfling
Posts: 66
Joined: Thu Jan 13, 2005 2:38 pm
Location: UK

Post by muppet »

Thanks for your suggestions guys. I'll take a look into both ideas and see how they fair.

Thanks
Muppet
Drew_Benton
Halfling
Posts: 95
Joined: Sun Apr 03, 2005 6:58 pm

Post by Drew_Benton »

You know how you have something like:

Code: Select all

if( mRoot->showConfigDialog() )
{
      mWindow = mRoot->initialise( true, "Ogre Caption" );
}
Can't you just pass false to that so you don't have a window created?
User avatar
bal
Greenskin
Posts: 100
Joined: Thu Dec 09, 2004 7:29 pm
Location: Geluwe, Belgium

Post by bal »

No, Drew_Benten, because as far as I know then you say you'll create the RenderWindow yourself later with perhaps some additional parameters... If you want to render you'll need a RenderWindow I think.
User avatar
CombatWombat
Greenskin
Posts: 138
Joined: Fri Feb 04, 2005 11:05 pm
Location: Melbourne, Aus

Post by CombatWombat »

Hey Muppet, I'm interested to find out where you guys went with this. I'm wanting to do exactly the same thing with the dedicated server, and the only option seems to be a null RenderSystem.

(I'm wanting to load meshes via Ogre then use my own collision detection in the server)

Did you end up writing a null RenderSystem?
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

CombatWombat wrote:(I'm wanting to load meshes via Ogre then use my own collision detection in the server)
If you're going to use your own collision detection, and if you're only going to load the meshes, you can do that without ever touching a render system. The XML converter and Mesh upgrader do this. Maybe it's more complicated if you also want to use Ogre's scene graph, but I'm not sure about that.
friend_of_ACCU wrote:HEY you should add an option to read config from config file of course if your ego is not too high... :D
What are you talking about? :?
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

friend_of_ACCU wrote:You could allow to switch off the configuration window popup. That probably could be useful.
Ah, it's only displayed if you ask for it. (See here for an alternative way to load the configuration.) But that's not what the original post was about.
User avatar
CombatWombat
Greenskin
Posts: 138
Joined: Fri Feb 04, 2005 11:05 pm
Location: Melbourne, Aus

Post by CombatWombat »

DWORD wrote:If you're going to use your own collision detection, and if you're only going to load the meshes, you can do that without ever touching a render system.
Thanks, I've wikied how I got it working at this page
User avatar
Walley
Greenskin
Posts: 120
Joined: Fri Dec 03, 2004 4:37 am
Location: Victoria, Australia

Post by Walley »

In my opinion it's poor design to have a dedicated server running Ogre...

Alongside the additional overhead is the fact that the main thing Ogre does is visualize the information you give it - so trying to have it manage the information and give it out is like doing things in reverse.
Besides, the objects in Ogre generally aren't enough to realistically manage game objects, hence for a decent design you'll need your own classes. It is *these* classes that would be used by the server, not Ogre.
User avatar
CombatWombat
Greenskin
Posts: 138
Joined: Fri Feb 04, 2005 11:05 pm
Location: Melbourne, Aus

Post by CombatWombat »

Walley wrote:In my opinion it's poor design to have a dedicated server running Ogre...

Alongside the additional overhead is the fact that the main thing Ogre does is visualize the information you give it - so trying to have it manage the information and give it out is like doing things in reverse.
Besides, the objects in Ogre generally aren't enough to realistically manage game objects, hence for a decent design you'll need your own classes. It is *these* classes that would be used by the server, not Ogre.
Certainly, in complete agreement with all you've said here.

What I'm after is the mesh data so that I can do hit detection (line of sight, line of fire type stuff) with the same model which I'm using for rendering. Rather than running a second model converter, I'd like to use the Ogre model.

All my game object classes are independent from Ogre (save for the entity/scenenode pointer, but this is only valid where rendering is being done) and they have a pointer to the (shared) collision mesh which is appropriate for them. These shared collision meshes get built from the meshes I get Ogre to load for me.
The_Fallen
Gnoblar
Posts: 6
Joined: Thu Jul 21, 2005 9:47 am

Post by The_Fallen »

:wumpus: wrote:You could still use the Ogre classes that don't depend on a RenderSystem without initializing a RenderSystem. That's much nicer than a null plugins, I just detest null plugins, but that's something personal.
Sorry, that I am posting in this thread, but I currently have the exact same problem. I'm working on a client/server game and for the server I also want to use some Ogre classes (for mesh loading, timers, ...).

But when I try to create a timer without some initialisation of Ogre before, I get an assertion error. I create the timer like this:

Code: Select all

m_Timer = Ogre::PlatformManager::getSingleton().createTimer();
At the console it says this:

Code: Select all

Assertion failed: ms_Singleton, file c:\softwaredevelopment\c++\ogresdk\ogrenew\ogremain\src\ogreplatformmanager.cpp, line 45
Any idea what's going wrong?

thx,
fallen
User avatar
CombatWombat
Greenskin
Posts: 138
Joined: Fri Feb 04, 2005 11:05 pm
Location: Melbourne, Aus

Post by CombatWombat »

The platform manager singleton must be created before you can use it. Usually this gets done when you create the Ogre Root (note the Root doesn't have to be initialised), but you can create it directly like so:

Code: Select all

new Ogre::PlatformManager;
(Ogre::PlatformManager is also an Ogre::Singleton, and the Ogre::Singleton constructor stores the pointer to the singleton away)

You might have more problems to sort out from there onwards, I've got my own timer class so that's why I've not hit this one.
The_Fallen
Gnoblar
Posts: 6
Joined: Thu Jul 21, 2005 9:47 am

Post by The_Fallen »

Thanks, but it doesn't work, same problem as before. PlatformManager needs DynLibManager, but somehow I can't create an instance of this class...
So, I will also use my own timer class. But will I run into the same problem, when I use other classes from Ogre (like Mesh etc)?
User avatar
CombatWombat
Greenskin
Posts: 138
Joined: Fri Feb 04, 2005 11:05 pm
Location: Melbourne, Aus

Post by CombatWombat »

The_Fallen wrote:Thanks, but it doesn't work, same problem as before. PlatformManager needs DynLibManager, but somehow I can't create an instance of this class...
So, I will also use my own timer class. But will I run into the same problem, when I use other classes from Ogre (like Mesh etc)?
You can safely use Ogre Mesh class if you go through the instructions on this page.

You can also create the Ogre timer object safely after that same setup, but you may need some additional Ogre calls to get the timers ticking over - I've not looked at how they're implemented.
Post Reply