• entries
557
1237
• views
422516

# You'll find the back of my hand rather displeasing

95 views

Well, I think I mentioned a while ago that I'm making an MMORPG, and I finally got round to coding today, after my ex left to go home following 4 days of computer-stealage.

Anyway, it's pointless at the moment, but it can set up a nice window and draw a crap map. By "nice window", I mean a window that minimizes and maximizes properly, and all that stuff. By "crap map", I mean a map that sucks. Because I don't have a map editor, I'm manually making the map in a hex editor. Oh joy.

Here's a preview of the map. But if I find anyone plagerising it, I'll uhm... laugh:
4D 4D 41 50 64 00 00 00   64 00 00 00 02 00 00 0000 00 01 00 00 00 04 00   00 00 00 00 00 00 00 0100 00 02 01 00 02 01 00   00 00 00 00 00 00

That defines the first two tiles (01 00 00 00 and 00 00 00 00). The rest of the file is filled with 0 bytes, because they are all tile id 0.
I'll give a slight explanation of the file format so far. The first 4 bytes are the signature ("MMAP"), the next two dwords are the width and height (100x100). After that is a word (2 bytes) which says how many tile sheets there are (2), and that many dwords are then read to tell what tile sheets this map needs loaded (0 and 1). Then there's a dword telling how many tile lookups there are, and then that many 3-byte sets are read.
Because a map contains several tiles from various tile sheets, you need a way to say "tile 17 in sheet 4" and suchlike. The way I handle this is with lookups. I say "Let tile ID 0 be tile 17 on sheet 4", and then refer to it as tile id 0 in the actual map data.
The 3-byte sets are one word to say what sheet to reference (out of the ones loaded above), and one byte to say what tile. Since a tile sheet is a 256x256 bitmap which contains a set of 32x32px tiles, you can refer to each tile with a number between 0 and 64 (you get 8x8 tiles on a sheet).

For performance reasons, when I load the tile sheets that the map needs, I stuff them into a large texture (as large as the card supports, but not any larger than it needs to be). When I render, I only need to render using 1 or 2 textures, and I just render as a triangle list. Each frame, I refill the vertex buffer (Although I might change that to only fill it if the map has moved), and then just draw it in one DrawPrimitive() call.
Since the map is 32x24 tiles, thats only a loop of 768 times to update the map. If there's more than one internal texture (the huge one), then it'll require several passes to fill the VB. But it's still not a problem.

What else have I been up to? Hmm, not much. As I said, my ex has been here for the past 4 days, and we've just been complete pies and been watching The Mighty Boosh and Aqua Teen Hunger Force and getting drunk. Yay.
If you haven't seen The Mighty Boosh, you can watch it on the BBC website (I've lost the link though). As for ATHF, you'll have to get it on DVD or something. But they're both fearsome. In fact, I'm going to go and watch a bit of series 1 of The Mighty Boosh. Hooray for Tesco selling better DVDs than HMV or Virgin...

There are no comments to display.