Page 1 of 1

initialise() methods

Posted: Sun Dec 14, 2008 5:31 pm
by 1337
Something for after the presentation:
I think we might need an initialise() method for certain classes like Level or Scene or maybe Gametype.
The idea is from an issue with physics: I cannot add the WorldEntities directly to the Scene (and with it Bullet) because that would mean every time something vital changes about the physical body, it has to be removed and added again. Thats awfully slow.
There's also some issues with that.

--> Objects get added in the first tick. But thats bad practice.
Much better would probably be a function that gets called in the Scene AFTER the level has been loaded. I'm sure there are other areas of applications.

Never mind right now, we've got loads of important stuff to work on. ;)

Posted: Mon Dec 15, 2008 2:53 pm
by beni
So if I understand this right you first want to load a practically empty scene and then start adding objects afterward?

What does 'vital changes' mean in reference to the physical body?

I agree it's bad practice to load everything in the first tick. But I don't understand the issue, I guess. Please shed some more light on it, maybe with an example or something, if possible.

Posted: Mon Dec 15, 2008 2:56 pm
by 1337
quite simple: After everything has been loaded from the XML file, we simply tell the Level and the Scene that they can do some preparations, that are only possible after everything is set.

By "adding" I meant adding physical bodies to Bullet, which is quite separate.

Posted: Mon Dec 15, 2008 3:01 pm
by beni
Oh AFTER loading. Now I got it.. I guess that we need to work on loading anyway since a level consists of so much more than what we have right now. So this'll need much work anyway. A initialise function after setting everything seems a reasonable thing to do.

Posted: Mon Dec 15, 2008 3:15 pm
by 1337
Actually, the loader can do everything I can think of right now...
Except that one little request.
But anyway, what more do you want wit loading?

Posted: Mon Dec 15, 2008 3:57 pm
by x3n
The problem is not that easy, there are several processes which are somehow close to loading and it should always work, with or without initialization. But as you said, that's not the main problem right now. ;)

Posted: Mon Dec 15, 2008 4:05 pm
by greenman
just not that i forget it:

having an initialize routing may improve our single-player performance, but imagine the loading process on a client:
- server sends all objects
- each object is first getting created on the client with default values and then all variables of the object are being updated. this happens one-by-one for every object (same order as on server)
- maybe during update of variables callbacks are being called

so as you might realise an initialization function could be problematic on clients

Posted: Mon Dec 15, 2008 4:14 pm
by 1337
yeah, I see can that...
seems almost impossible.