Friday, December 16, 2011

Sick of maps yet? Yes I am.

So, yeah, there's all this great technology for storing data, retrieving it quickly, etc.  Just realised however that there's not really a magic bullet, as I thought there was, there's just lots of ideas that may or may not be useful.  The key is to define what exactly you're trying to do, then find the tech that lets you do it the best.  For example, I was recently reading about John Carmack of id software doing some cool stuff with shadows in Doom 3.  Well it wasn't a solution he came up with, it was one he implemented that someone else came up with in 1976.  So yeah, it wasn't the magic bullet for a lot of people, but it was for him, he just found that it solved his particular problem.

Alright, enough exposition.  What's my problem?

K, we've got entities, lots of em.  The walls, the monsters, the items, maybe even the floors.  They're all in this massive dictionary at the moment.  Which.. now that I think about it.. probably isn't going to work once we're talking about a couple million entities.. Hunh.  Dangit.  Well, no, wait, hold that thought.  What will solve the map problem should solve the problem with the rest of the entities.  For one thing, getting the map to work should let us break our massive lists of items into small chunks.  Though.. how will that work.  They're all in a big dictionary right now.  Even if we're not looping through every item in the dictionary, looking up items by name in a million entry dictionary is still time consuming.

And now that I think about it, if we're talking about a million items, and they have memberships in many multiple dictionaries, then we've got multimillions of stuff in ram.. :P

Alright alright.. stop that.  I have no way of knowing what is and what isn't a misuse of resources or whatever.  I wouldn't know because I've never finished writing a game.  So,back on point.

We have, entities.  We need, simple boolean grids for line of sight, for light fall, for collision.

Okay random thought.. (darn you add) so, I'm trying to see how we're going to deal with AIs that are off screen.  Unless we're simulating the entire world, then we need to break it down.  So here's a thought.  We run the ai for all entities within one screen of the player, so nine total, but then also run it for all the screens he's visited for a certain amount of time.  That way you can't piss something off, run away three screens, and when you come back it's forgotten about you.  Plus it would be cool if it's computationally economical to run the ais for more than just one screen around the player.  We'll see.

---
man... I've got dora the explorer playing on a tv that's about ... well it's about one foot away from my head.  Plus I was asked to rip an avi of Elmo's Potty time.  My thought process is totally screwed.  I guess I'll be back for episode 24 of maps in hell...

No comments:

Post a Comment