[WIP] A generic platformer w/ object-oriented game engine

Advice on general approaches or feasibility and discussions about game design

Re: [WIP] A generic platformer w/ object-oriented game engin

Postby Jamish » Sat Jan 10, 2015 11:49 pm

Myndale wrote:You actually have a number of options here. The best plan is probably to design your architecture so that you never have to do any per-frame allocations (e.g. by maintaining a bank of objects) but if that's not an option then one workaround is to declare your own form of the placement new operator like this:


I'll probably do a bank of objects. Different objects will have a different byte size in memory (because they might use different variables), so I'll either have to normalize the sizes, or maybe use unions or structs? For example, give the base enemy class an extra 32 byte struct, and have each inheriting class override that struct with any combination of variables they need that come in under 32 bytes. That way all enemies have the same size and I can allocate an array for a max number of them at compile time.

(...you can cast/override unions or structs like that, right?)

EDIT: There seem to be a few solutions here that will help me out.
User avatar
Jamish
 
Posts: 73
Joined: Wed Dec 17, 2014 6:52 pm
Location: California

Re: [WIP] A generic platformer w/ object-oriented game engin

Postby Drakker » Sun Jan 11, 2015 1:11 pm

Great job Jamish!

Considering that in almost every game made so far, the vast vast vast majority of bitmaps are 8px/1 byte wide, maybe there should be a more optimized drawBitmap function that draws only 8px wide bitmaps, with maybe HFLIP and VFLIP, but without rotation. That would remove a few operations used to find the size of the bitmap and shift through it and a few branches in the logic to change the direction/rotation of drawing. As usual I have no idea how much faster that could be on Arduino, but I'm throwing the idea out there for you more experienced guys to comment on it.
User avatar
Drakker
 
Posts: 297
Joined: Sun Mar 30, 2014 2:54 am
Location: Québec, Canada

Re: [WIP] A generic platformer w/ object-oriented game engin

Postby rodot » Sun Jan 11, 2015 6:50 pm

I created a new topic in Software Development dedicated to graphical functions optimization, because we are getting pretty out of topic here :P
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Previous

Return to Project Guidance & Game development

Who is online

Users browsing this forum: No registered users and 8 guests

cron