Sunday, July 02, 2006

Celestial ninja syndrome

Movement's in! Yay. I didn't think I was going to get it finished by this weekend as I spent all of today cleaning my flat (as I'm leaving soon). Anyway all done. Mysteriously it seems to cut into the framerate more than expected so I'll have a look into that.

Here's an NPC brain (which could easily be swapped out for a brain that took input from the keyboard or something). It moves one tile down then stops.

public class WanderBrain : IBrain
bool tempHaveMoved = false;
#region IBrain Members

public void Process(double elapsedTime, Entity entity, IEntityMap eMap)
if (!entity.Mover.Moving && !tempHaveMoved)
entity.Mover.Move(Direction.down, eMap);
tempHaveMoved = true;


(I'm trying out the component model for my entities, current components that are required are a brain, I already use pretty much the same setup in einfall, and a mover that handles how the entity moves over the tilemap. I haven't put general components in yet.)

So suddenly I'm doing tile based movement where as before I had free wandering :D Still I can have freewandering for the player character and eveyone else locked into the tyranny of tile movement.

Anyway overall much much faster than einfall. Not done quite yet though ... I want to add items that will sit on the tiles. I'll probably also add some simple loading and saving stuff. Oh and I'll make the bottom set of tiles a static vertex buffer with a dirty flag - this should keep things faster!

No comments: