Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Day 07: People are moving around.

Yesterday I got basically bit farther or shorter than expected. On one hand I did have map done... somewhat. Perhaps not to state i basically wished, but that is what I have still been using. On the ohther hand, I also got people being randomly spread around city based upon numbers.

Today I continued from that and now humans are walking around the city using roads I have set up. I am currently thinking of hiding roads from players, that they are invisible roads that AI humans follow. They Currently consist of 4 different pieces. Roads where you can go left or right, roads where you can go up or down. Junctions, and escape tiles.

Basically people are places at random around city at start, with some locations having higher probability than others, this way each play has some randomness and it saves me whole load of time not having to figure out where thousand people should be placed at beginning of level.

Depending upon their location, they pick direction the start moving. As example, left-right road piece, they ether start going left or right. Then they continue until they come to junction or escape tile. Escape tile and they disappear. Junction, and they look at possible ways to go and choose by random to go on one of the available directions that is not the same way they came from.

There is actually small possibility that some human might turn back to same way it came, due to how i check the direction.

Basically to make it as light as possible, human movement is fairly simple. It moves X amount and Y amount in each cycle. This X and Y amount is decided when new direction (as example in junction) is checked. Basically I look that if X distance to new location is 123 and Y distance is 45, then i sum these up = 123 + 45 = 168 and then I simply do xmove = 123 / 168 and ymove=45/168.

When at junction i compare xmove and ymove numbers, the one that is bigger to other, tells wether it is going left-right or up-down direction. 

However, there is small chance that if two junctions are right beside each other, that as the co-ordinates for new tile are picked by random, that if im moving right, but i happen to be at right edge od current tile, and then it randomly pick left edge of new tile, and at same time I am at bottom of old tile, and new co-ordinate is top of new tile, then Y-move becomes actually bigger than X-move, and in this case the direction is errorenously decided to be coming from wrong direction.

However, this is rare occurence, and, perhaps it seems even more intelligent that some rare times, AI decides to get back the same way it came, although it is actually in error, so let it be.


Tomorrow I am going for the Robots. Have to first figure out how to make a spawn point for them, and then the control buttons, after that they can start looking for targets.

I also just less than hour ago realised there is one potential problem I am not sure how to solve yet. For basically when robots go attack against people, they should target one of the closest ones, but actually the closest one keeps moving all the time, so who knows where the robots end. Not sure how to fix this yet. Of course they could keep looking at who is the closest, but this could be quite resource hungry. But then again, I have loads of moving people and speed havent slowed down noticably at all. So perhaps max? 200 robots could go through more demanding AI. Hopefully I will know more tomorrow.