Tuesday, December 27, 2011

Motivation waning...

Gah.. I hate this part.. So, I'm not happy with what I've done so far in the game, and it's making it so I have really low motivation to keep going.  I feel like I need to rewrite the engine, and at the same time, all my friends are kind of "meh" on the game concept.  I don't know who I thought would play the game, but that's part of the fun of making a game for me, is imagining people playing it.  I suppose I could just make it for me, yada yada.  So, my todo list right now looks like:

1. Copy the most recent codebase off my craptastic laptop so I can work on it on my much nicer desktop machine.
2. Reorganize the game engine, and start a rewrite focusing on making things more clear and encapsulated.
3. Try not to feel guilty every time I sit down to code that I'm not doing something more productive like look for a job, or something.
4. Find the motivation to continue working on it, even though I might be the only one who plays it.

Yeah, that looks about right for now.

Thursday, December 22, 2011

Intermission

Alright, I realised the other night that I was totally lost in my own code.  I was writing code and just waiting for the error messages to see if I was doing it right.  Bad, bad, bad.  So, I decided to just do a rewrite, with a mind toward consistency, readability, and ... yeah, just kind of a rethink.  For one thing, I'm going to be a little more lenient with my self about what's an entity and what isn't.  I mean, I tried when I first started, making the screen an entity.  It was a pain.  Recently I tried to make the map an entity.  I mean... will the map ever have an image of it's own, or get turned into a shoe or something like that?  No?  Then it really shouldn't be an entity.

Oh, another important lesson I learned the other night.  If you're going to load an image into memory for every entity, don't make a 1024x1024 map filled with unique floor entities.  Yeah... didn't think that one through.

So.. different topic for once.  Just for fun.  I

Crap... Gotta pick up my son from school. Until next time... :-)

Tuesday, December 20, 2011

Fragmentation blues

This constant starting and stopping work on my game is really becoming a problem.  There's no way I can just work on it non-stop, which I would do if I could, so I need to find some kind of project management tool.

For instance, I set up my ghetto laptop (the old Dell that had water mysteriously spilled on it. Still works, but needs a usb keyboard hooked up to it) at a friends house the other night and got to work for about 4 hours straight.  It was nice.  One thing that came from that though, is that I found one major instance where I was working on two different solutions to the same problem in different parts of code.  Ugh.  I think every time I would sit down to code for 20 minutes, one or the other solution would come to mind and I would chip away at it.  Never realised what I was doing until I had enough time to work the problem all the way through and ran into the other solution.

Anyway, a good friend of mine, and professional project manager, suggested at least I use a project outline with items I check off as in progress or completed, etc.  He spent some time with me yesterday fleshing out an outline.

Another problem with not having any type of project management, as well as having unpredictable obligations with family, is getting interrupted in the middle of big rewrites or major changes.  I feel like a surgeon, covered in blood holding a patients guts in his hand, who is just told he needs to stop immediately and do something else.  Meh.

There's nothing useful in this post.  Just venting.

Oh, I'm back on map crap.  I think I finally found a solution that will work.  I forgot to think about what will make it easy for the render function to quickly get all the items that need to be drawn, and in what order.  Plus the ordered list for what's in a tile location is gone.  I'm going with three layers.  Background has only one item, foreground has only one item, and midground has a list ordered by eid (arbitrary, doesn't matter but shouldn't change).  Background and midground are always passable and foreground always blocks movement and line of sight.

And.. I should be coding instead of yakking.

Saturday, December 17, 2011

Not dead yet

Alright.  Normally this spiraling out of control obsessing about a problem would kill a project for me.  Especially when I'm getting zero time to work on it.  Today, I'm using up part of the half hour I have to work to write this.  I keep swinging back and forth between maybe I'm doing too much, to maybe I'm doing too little.


So here's what I've got so far, and this is what I'm gonna try to implement:
Dictionary of Maps -> Dictionary of Areas -> Dictionary of tiles -> lists of objects.

Map keys are tuples, (name, level).
Area keys are tuples of grid coordinates (area_x, area_y)
Tile keys are tuples as well (tile_x, tile_y)

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...

Thursday, December 15, 2011

Maps maps maps...

Alright, so one of the problems I'm having I think is that.. I don't so much need a traditional map, with or without layers.. I need a world space for things to exist.  I mean, everything has coordinates, so why would some things be in a special map grid, and some things not.  Still not totally sure how the map is going to work, because for some things like LOS calculation or pathfinding, we're going to want a simple 2bit array of walkable/visible space.  But I think it'll probably be some type of BSP tree, or other hierarchical structure.  The entire world being the first node, then somewhere along the line there will be a screen sized node, then a square tile sized node, then ... what else.  Need to keep reading, both for education and inspiration.

Map hell

Dear god.. what am I doing.  Spending hours reading about bsp trees, sparse matrices, other crazy stuff.  I feel like there's a right way to do something, and that's the way I want to do it, even if I have to spend hours reworking or learning something to do it.

Of course, the problem is how could I possibly know what the "right" way is.  Maybe it helps that I get fixated on ideas sometimes.  Or that's the cause, not the cure.  Eh.  No matter... I have to take the fam to the grocery store right now anyway.