Wednesday, December 14, 2011

Alright, so, more map brain storming...

Alright.. I'm liking the map scrolling system from the last post well enough.  Well enough to test it out at least.  Now, as far as storing map data.. how are we going to do that.  If I'm using something like libtcod for line of sight and pathfinding, then I'll need to pass it an array, not a list of entities.  I can have a system that creates that and passes it to the lib.. though I feel like that would be really computationally intensive...

Having a little trouble keeping a solid train of thought.. At my mother's house at the moment.  One kid is playing 10 feet to my left, one is playing 5 feet to my right, and my wife is talking about something.  Not to me.  I suppose I'm being a little rude by doing this rather than participating in various activities.  Eh, oh well.

Ugh, plus I've got to do something incredibly stressful in a couple hours. :-P  This guy that I worked with before I was laid off a couple months ago needs help with some computer stuff, and for some reason wants me to come down and help him.  He's paying me some unknown amount, rather than ask the IT staff that still work there, probably because the guys that are still there are jerks. ;-P  Well, no, really, they are.

Alright, totally sidetracked at this point.  Not going on a rant ... :P  Can either stop writing... oh dear, my 2 year old is pounding on the piano now... or try to muster my concentration and see what I can do.  I really am interested in finishing this game, so I'm going to try and keep working.

It would be cool if I had a laptop or something.  I could be programming right now instead of just blogging.. or journalling, or blathering, or whatever..

Anyway.. okay.. so the problem is, how do we deal with the map.  If the map tiles are going to be just another entity, then they shouldn't have a special map aspect since there will be a lot of things drawn besides map tiles.  They might need a weight, or layer property somewhere.  Maybe in the form aspect, like they already have an x and a y, so maybe they need a z.  The problem there is.. keeping track of what's on top of what.  Somewhere there has to be a list of what's in a tile so that we don't end up with two things with the same z.

Argh... interruptions every two seconds... gah... I need a hole in the ground, or a tree house, or a log cabin on the side of a mountain, or something. :-B

wtf.. where was I.  The ground is immutable, since it's a 2d game, so you could just have this massive grid and everything is assigned a unique id for what square in the world it exists.  That seems to go against the whole entity system though... I guess it makes sense though.  The alternative would be what.. you have each entity know what is above, below and beside it, and you draw the world relative to the player.  This massive linked list.. sort of.

Ugh... this is obviously not a good time to be working on this.  My wife just asked if she left some persimmons in the trunk of the car and I nearly lost it.  Wtf?!? Go look! I have no idea what you did with the persimmons you bought.  Are you telling me we have fruit rotting in the car?  I suppose if they are in the car, you need me to go get them, yes? :P

Eh.. better vent here than cause problems.  Gah...

Map brain storming..

Or should I say, thinking out loud.  Or.. thinking.. while/through typing.. or whatever.

I'm trying to visualise the movement system.  I don't want to do zelda style because that kind of breaks with line of sight.  If you're going to have connected maps you can't walk off the screen and be right next to some terrible danger or off a cliff or something.  Since we're doing fluid, connected maps..

Well, even that.. why think of the world as a series of connected maps?  I guess for one reason, so the game doesn't have to think about the entire world just to show the small area the player is in.  But back to screen movement.. I don't want to ahve the player be a fixed point on the screen and have the world move when you walk.  Then again, that's how world of warcraft does it.. and how all fps games do it.  Heck, that's how real life is.  Seems like it would be "cinematically" disorienting though.  Kind of like watching a movie in first person view.  Hmm.. maybe it's only disorienting when you're not in direct control.  Like, do the player in the center version when you're tap, tap, tapping your movements, but hold the world still and move the player when you're doing walk to point movement, then reorient when you stop. ?  eh.. gotta go pick up my son from school.. think about this more later.

Maps...

Ugh... how am I gonna do the game maps.

In the past, when I've needed a map for a tile game, I just create a 2d array, and there you go.  Fill the array with tile objects.  Now though, with this entity system, things are different.  For one, all entities already have coordinates, so there's no need for a map array.  Although having one could make looping through just the map tiles easier.  Plus if map tiles are just another entity... and this is a 2d game, I've got to separate layers.. like what's passable and what's not, what gets drawn on top.  I don't want to necessarily say that just because something is terrain it's on the bottom layer.  There will be other entities laying about, and they all need layer information too.  No reason to create a special case just for terrain.

Another thought I had was... what is the coordinate system even based off of?  Is the whole world just the size of the screen?  Should it be infinite?  If so, how do you work out the offset for coordinates.  Maybe the game should run old school zelda style, where if you walk off the edge of the screen, another map slides into view.

Ah.... interesting thought.  So, what if... You have a map aspect/entity that represents one screen full of information.  Then tiles, monsters, whatever can have their x,y grid relative to the map they are associated with.  Then the map has the names or ids of the four other maps that are adjacent to it.  Then you can have infinite maps without coordinates.  Oh six maps, I guess.  For above and below as well.  Hmm.. another thought.  This wouldn't even have to be screen sized maps either.  They could be anything.  256x256, 16x16, whatever.  It would just be a way of chunking up the map.

Alright, so, big question.  Are we doing the Zelda style maps that flip when you reach the edge, or smooth scrolling to infinite distance...

You know, it would be a lot easier to do the zelda style.. but more fun to have the infinite scrolling style.  But much harder..

Tuesday, December 13, 2011

Wierdness..

Alright, so... The weird thing isn't that blogging has helped me work through problems, the weird thing is that now I just imagine blogging and the solution comes to me...

meta entity.. possible misuse of the word meta...

Alright, form thingy done, dead code pruned.  Now I only have two aspects, goal and form.  To be added will be things like container, and health, and other stuffs..

So.. I want to have an aspect that designates who is controlling the entity.  The idea being that the player might at some point be in control of a monster, or something.  Plus the AI systems would have lists of who they were controlling.

Well, I guess that answers my question.. sort of.. maybe it's more of a trailhead than a finish line.  Anyway, the problem is, if the player entity needs the id of the controlling entity, would it be itself?  Or can I assign an entity id to someone sitting at home playing this game on their computer?  I think the answer will come when I decide how the AI system will work.  I'm assuming it will be sending a stream of goals for the action system to chew on, just like the player input system does.  So, however I decide to identify the AIs of the game will be the same way I identify the player.

Latest issue

Ugh.. okay, so got the little dude running around.  Now I need a world for him to run around in.  So, map tiles.  Seems like they could be just another entity.  I like this idea.  No idea what the performance effect would be, but hey, this is 2011, not 1988, so it really shouldn't be an issue.

Now, the issue is, I want a "blockable" or "blocking" flag for my high-tech tile based collision system.  So, do I create a new aspect called "blocking" or do I tack that on to appearance.  But now appearance isn't just about what the item looks like, so as long as we're doing that, maybe we should roll the "position" aspect into appearance and call it "form" instead.  It would let me pass just one thing to the render system, though how many things I pass is really inconsequential.  I dunno.  I want to avoid lumping too many things together, though how granular do I really want to get.  I can't think of too many things that have a position that don't have an appearance, eh... screw it, I'm doing it.  Lets see if I can keep from breaking everything as I roll everything into a "form" aspect.

Why am I doing this instead of coding

I guess because I was thinking about it as I was falling asleep last night.  I was wondering how many lines of code it took me to get to "little guy moving around the screen". The answer is.... 461.  I have no experience to tell me if this is a lot or not, but I do know in other languages I've done the same thing, at least on the surface, in about 10 lines.

Edit: decided to go for 16x16 sprites.  For good or bad, it'll let me draw the whole map on the screen at once and not worry about scrolling, at least for now.

Oh, and how hard was it to change from 32x32 tiles to 16x16?  Just had to change the number 32 to 16 in one spot.  Neat!