• entries
707
1173
• views
436777

# Map concept screenshot

273 views

Ok, I haven't done any coding yet tonight, I'm trying to figure out what I will need ahead of time. This is what the maps will loop like:

The block in the top left is what the rest of the map is conposed of. It is 96x128 (designed as 32 size chunks.)

I will have a class called Entity:
class Entity{public:    virtual void OnEntityIntersect(Entity* pEntity);    virtual Quad* GetVertices(int* pQuadCount);};// Of course, this isn't the whole class, just the pertinent info// for the update.

Then, from that I would derive platform from entity. Platform would contain 12 quads (3 for the each row; top, middle, bottom, below platform (dirt in this example)). My quad class will pretty much handle everything. I need to set the position for each chunk:

6 Corners = 32x32 (top left, top right, bottom left, bottom right, below left, and below right)
Top & bottom & below middle = platform width - 64 x 32
Left & right = 32 x platform height - 96 (includes 2 corners and the dirt)
middle = platform width - 64 x platform height - 96

The quad class automatically has the ability to set the source rectangle so that the U/V coordinates are > 1 (for tiling the center instead of stretching.)

My advice to everybody - build a base renderable class that has the following support:

• Visible updating (for clipping; don't modify any members other than the vertices. This is what I used for the font engine)
• UV mapping (source rect is < quad size, stretch or tile?)
• GetVertices() function that takes a pointer to vertices as well as the a GetVertexCount() function (so that subclasses can have more vertices.)
• Never automatically fill the vertices, separate this into a separate call.
• Two versions of GetVertices(), one that allows the user to update and one that just returns the vertices (well, assigns the pointer to them.)

This class is my holy grail. I use it for everything graphical in the engine. It is especially helpful for the font engine. In my font's print function I have a vector of these. If I detect a a special character, I can react to it correctly. For instance, my first font engine didn't replace tabs with spaces, it replace tabs with 4 * the size of a space. But, what if for some reason I had something in the texture for the space OTHER than blank space (for instance in a wingding style font.) So, with the quad class I can just push in 4 spaces. No need to modify my string, no reallocations by me (the vector resizes, but it shouldn't too often because of the call to reserve.)

While I'm on the topic of bitmap fonts, I did some more tests. I typed up a short story (1003 characters not including \t and \n.)

With ID3DXFont, the frame rate pretty much stays at 77, going to a low of 75 at times. Contains slightly less characters (removed coloring codes.)

dft::BmpFont drops from 77 to a low of 70. I don't feel that this is a huge drop, considering the ammount of characters being rendered, 4 special cases (\b doesn't really count, since all it does it use continue;. \t adds 4 space characters. \n moves to the next line and resets the x value. and ^# which colors the text of course.)

Well, I can't seem to keep my eyes open very long. Tell me what you think and I'll post an update in the morning.

There are no comments to display.

## Create an account

Register a new account