Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to manage my game objects?

Author
Message
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 10th Oct 2008 15:54
Currently I'm loading most of my objects at the start of the game, and then excluding/including them as I move between different scenes in the game.

My game essentially consists of 4 or 5 mini-games strung together with very few assets re-used between each mini-game. But you do loop through each mini game a few times in one complete run through of the game.

The docs say that deleting objects is slow, but where is the line between excluding/including objects as you need them and deleting/recreating them?

How do you guys deal with managing the various objects in your games?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Oct 2008 18:19
The first step for me is excluding objects during game play, and deleting betweeen games/levels.

MayoZebraHat 1979
16
Years of Service
User Offline
Joined: 21st Dec 2007
Location:
Posted: 12th Oct 2008 08:06 Edited at: 12th Oct 2008 08:20
I load right away (first load screen) and keep what objects/images are always used in each level/area in memory: UI, HUD, player, etc.

Durring level/area loads I use LUA scripts and object lists to help decide what objects from the last load can stay and which ones can be removed, as well as what new objects are needed. Often times I find I keep a lot of the same objects anyway.

You can also delay object removal to happen every so often or based on player location. I've been testing this with Ian Mold's (Matrix plugins) co-operative multi-threading (ie, not the multi-process kind of multi-threading) and ticker features. If you have a large list of things to kill and it would bog you down to do all at once, you can do it based on a list of visible or pertinent objects. Kill one thing every so often and you don't notice it... I think. I dunno if it's a solid practice, I'm a bit insane/masochistic so it works and makes perfect sense to me. I think it helps with the more "seamless/loading-less world" type situations.

Also, you may wanna profile the lag you get from deleting objects. Just try deleting a lot of things between a profile timer and see what happens. It may not be that bad in your case. Like so:


I get quicker delete times than make times on this one... then again I could be misinterpreting any given element of the practice here, I have no formal training. The help file merely states that you shouldn't use these (as well as making objects) constantly in the main loop but loading screen routines are fine and dandy. Most games have them. Also remember that your target audience is likely to have at least 1GB or more of RAM, that's still quite a bit these days unless you do not optimize your resources.

Login to post a reply

Server time is: 2024-11-24 19:58:56
Your offset time is: 2024-11-24 19:58:56