08-05-2013, 02:22 PM
(08-05-2013, 10:23 AM)Terminal Devastation Wrote: I'm curious on how you all structure the inner engine in your games. Like what sort of little bits of hidden manager type objects/code you have running behind the scenes.
It has been a little while since i worked on the core engine of a 2D game. I used a component based system. This basically means that "unique" objects are created through aggregation/composition of smaller and unique behaviors/components. It allows for data-driven design too. It would be better for you to google than it would for me to explain these in detail.
Quote:I'm asking because the my last attempt at tried to code a game ended up unable to scroll a loaded level without lagging severely. I suspect the reason either I structured/sorted everything really badly or just horrid collision detection.
Although I don't have the slightest clue as to how you coded your game, my best bet would be the collision detection. Look into collision techniques, especially broad-phase collision detection. However, if you have a tile-based game going on, you can just check only surrounding tiles for an object. Also the ol' don't update or render anything outside of the screen area.
Quote:Even if its the latter, I think it'd be interesting to see how others do it. I just had an object manager class thing, and then a level manager that managed all the tile objects in the objectmanager... and I think thats where I messed up.
Do some googling. My entity system was "similar" to your vague statement. I had a Level class that contained *everything in the level, including a CollisionManger. This manager used all the collisionComponents of the level class and ...well did collision detection. -I should mention that the manager didn't just brute force test collision between every single object.
*I never got around to designing anything more than a "level". So this might not have been the best choice longterm.
I would show an example of the layout of how i implemented the system, but i think it would be better for you to just google and do a bit of research. Learning never hurts.