Respect Your Elders

   So I finished (nearly) everything I had to do today, except go to that grad party (hey, but it’s only fun to get drunk at night, right? 😉 Anyway, I’m going to move on to rain effects. But before I go into ten posts about how much I’ve fucked up rain, I’m going to address EvilNando’s comment on my review of his editor (or rather, blindfolded comparison).

   So I didn’t see that you could have up to 10 layers. And he does have a point: having lots of layers will hog up precious framerates. But I’ve already realized that, and while I post about all this shit I’m updating, I forget about small stuff I fixed along the way. I’ve already upgraded the layer Draw events so the code only runs 2 grid loops (a “grid loop” is one For loop for the X-axis, one nested for Y). Also, I make use of the -1 value as a tile value, so when the code hits -1, it just continues the code without running my piles of if-thens when there isn’t anything to check in the first place. These two imporvements drastically reduce framerate. Also, I edited the grid loops to only draw tiles that can be seen on the screen, reducing the amount of tiles drawn from 100 by 80 to 25 by 19. That’s 8,000 tiles to 475: a big improvement.

   Also while editing the code, and something I’ve talked about before: making the map export to one single file. Okay, so I don’t have it in XML, but yesterday I didn’t just work on day/night. That’s right – I have exporting and importing a map using Save File Dialogs (SFDs) and OFDs, potentially isolating the problem I had earlier and cacheing (is that even a word?) the textures upon load. By doing this, I eliminated the need to load up textures every Draw event, and also improved the framerate. In fact, I was so surprised at how freakin’ easy this was to do, that I’m inspired to make an editor release of my own, once I get the map files in XML and revert everything to that format.

   The need to copy and paste all tiles into one comprehensive tileset is evident, as well. But you see here is the dilemna: do you let the user do this on their own, or simply give the ability for the user to add more tilesets for each separate layer? Of course, you could load all tilesets in one layer, and then let the user change tilesets while still using the same layer. But that can get mighty confusing. I’ve chosen a different route – rather than making the user load one tileset for the entire map, I let them use as many as they wish on different layers. The advantage of my system: if the user wants to add a new segment of the map with a different tileset, they simply add a new layer with that tileset. Whereas with EvilNando’s system, the user is restricted to the tiles they picked when they began. If they really want to add new tiles in the current map, they must go into a paint app and edit the tileset they are currently using to include a new tileset, which is much less efficient than just adding a new layer.

Advertisements

~ by IG on July 12, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: