Tuesday, April 6, 2010

Exploring the world

Tinyworld is coming along well. I managed to fix all the issues with items displaying in the game world, all the issues with multiple floors, and all the issues with things drawing off the edge of the map. Great!

However, this brings me to an unfortunate point, one I knew would come (because I'm not the most efficient coder). The game is slowing down the more content I add in. The effect is certainly not as large as when things were drawing wrongly, or on the wrong maps, but it is there. The game is just a hair slower now than it used to be, and I've only got two dozen small maps.

Which means, as much as I didn't want to, I have to turn off the bulk process of every tile in the world, every clock tick. I really want the world to be living, so I'll have to come up with a more general way to handle this, perhaps running through each map the player isn't on one at a time (and thus much less frequently), or perhaps finding a more generalized way of handling them. Regardless, I have to make other maps static for now.

There's been a tiny bit of progress in working on the world, though. I know there are a few things I need to get building before I'm fully into an alpha though - towns, roads, more than the one type of dungeon, and so on.

Roads, is what I started with. They're the easiest. Of course, they're not randomly generating yet, but what I have working is that a map is chosen, and then a width, and weather the road runs horizontally or vertically. It then recursively calls each adjacent map and draws a road in the same position, direction, but one width smaller. And so, you can follow roads to their sources - which will eventually be towns. There's another thing I'll need to add, a source direction. This way, when you're on a map, you'll be able to tell which direction the road on it came from, and you won't need to guess. It'll be handy for dungeons and such, too. Put a big crosshair on each dungeon so you know when you're walking near them.

No comments:

Post a Comment