Update 7Boring but important progress today: I managed to export a .png file.

This has implications though. If I would have to save the levels as text files I'd only be able to save the geometry of the level, and all the graphics would have to be generated on start up. When you start the level you can't really tolerate more than 5 seconds for the level to be drawn, and this would mean a pretty simple layout.

If the level can be saved as an image file however, its graphics can be generated from the level editor. After you've made an awsome level you can possibly endure to wait a minute or two for intricate stuff such as hundreds of grass straws and light and shadows to be rendered, to make it look extra juicy.

Being able to save levels as images enables me to make levels look much more complex. This stuff is far in the future, but it's nice to know as it helps me when thinking about the overall art direction for the game.

Update 8I have started working on the AI today. What I've done up until now is path finding, getting from one place to another, but there has to be an AI that makes decisions on what places it wants to get to.

I do not want the croc to be omniscient, it will have to see its prey to know where it is. This will add a slight element of sneaking to the game, you'll want to take routes where the crocs can't see you.

In order for a unit to be able to navigate without knowing where everything is, it has to be able to have an estimation of where things are. This means a little mental mirror of sorts, that will sometimes cohere with and sometimes deviate from the real world.

This is what I've been doing today. Each Croc has a list of where it thinks the players are. For each player it can have a few different ideas, simplified they could be boiled down to:

Visual contact - I know where this particular player is because I see him.No Idea - I have no idea where this player is.Memory - I remember the last place I saw this player.

This is the framework I've been working on today. If the Croc has a memory about where it last saw a player and returns to that place without spotting the player there the memory will be deleted, and it once again has "No Idea" about where that player is. It also keeps track of how long ago it saw a player, maybe a memory will be deleted after a while because it's very unlikely that the player would remain anywhere close to that spot. As of now the crocs can't act on this information, but I'll get to that later.

The idea behind this is that if a croc hunts player 1, and in the corner of its eye sees player 2, then if it later looses track of player 1 it will be able to return to that point where player 2 was spotted. I will probably have to create some behaviour for searching the surroundings of a place, so that if it returns to a place where it remembered a player being it doesn't just give up, but looks around the area a little first.

Different crocs will probably have different mental stats as well as physical, with adjustments to memory, patience and the like.

Update 9Quite a lot of progress today, all happening inside the croc's head. Some basic behaviours are up and running, such as searching, idling, hunting.

The one that has been hardest so far is the "investigate" behaviour, where a croc is given a tile and is supposed to check out its immediate surroundings. Currently I do this by sending out a few "scout" checkpoints from the main checkpoint, they travel only in tiles that are accessable to the croc and stop after a few steps. The Croc then proceeds to check out the main tile and the "scouts" surrounding it, after which it considers the area investigated.

The hunting behaviour needs a lot of work. Especially when the player dissapears around a corner the behaviour is too unintelligent, in situations where it's fairly easy to estimate where the player might have gone it should do so.

Update 10The AI is coming together, and is now actually playable against (Even though there still aren't any effects from a croc colliding with you). The behaviour is now considerably more competent when it comes to pursuing you, if you for example disappear around a corner it will make a little "simulation" of where you might've gone, and act according to that estimation. It's all very simple, but seems to be working fine.

As it stands the lizards mill about the level idly until they see a player. Then they start hunting, and if the loose track of the player during the hunt they'll look around the area where they last saw him. If the player was moving during the last visual contact they crocs will estimate where he might have ended up since then, and look around that place instead.

One fun thing is the effects of having different ways of calculating visual contact and path finding. This means that a Croc can see a Bear across a gap, but to get there it has to take a much longer way.

I like these situations because here you can see the intelligence at work, you know that it doesn't just charge towards close targets, but it's actually able to plan a long and complicated route to get to a place. I'll try to make a video some time soon.

In the situation in the picture the player would probably be nowhere near that same place once the Croc finally arrives, and it'll use the "investigate" behaviour of the above post to look around for a little while before giving up and roaming the map again. I'm pretty happy with how all this is coming together.

I have noticed a few situations where Crocs get stuck though, will have to work on that.

Yeah, I hope you will be able to play with it in interesting ways. Right now you can do some stuff like dissapearing around several corners quickly, and watch how it gets confused and searches around for you, it's pretty fun.

Update 11Made the croc aware of when it has reached... eh, like, the destination of an old path that it follows until the new path is calculated... well, I made the croc not turn around again and again on the same spot.

Also I kind of identified and fixed (?) a path finding error that I'm not really even able to formulate for myself... The code is too extensive and complicated for me to fully understand at this point, but it seems to be working OK. Seems like a tile can't be weighted more than a passage between tiles, but if this is an inherent feat in the A* mathematics or something I messed up is beyond me. As long as I keep it in mind it shouldn't be a problem.

Made variable speeds for the croc depending on what it's doing, so that it'll speed up when chasing you and slow down when just roaming around.

Update 12Fixed some quirks and the above mentioned problem in the croc path finding. I pray this is the last time I write the words "croc path finding" in this dev log. Also improved the croc's estimation of where a player might have gone.

I didn't get around to write this as it was something that was finished before I started writing the log, but on the levels there are "short cuts", holes you can crawl into and be transported to another hole elsewhere on the map. This feature was included to make the levels less limited by being two dimensional, with a short cut it's possible to make a path that crosses another path without actually connecting to it, if you get what I mean. You can see the short cuts as the little white dots on the level editor screen shot in the original post, you probably already figured out what they where.

All three creatures in the game are able to use the short cuts, even though the A creature is very hesistant to enter one unless there's no other way around (it knows that a player might see it, and position himself at the exit for an easy kill). The croc path finding (DAMMIT!) has been able to handle those for a long time, and the crocs use them to transport themselves around the map. If a croc sees a player entering a short cut it doesn't simply follow him, but makes an independent estimation of what way is the quickest to get to the exit, through the short cut or by foot. If it's the latter an unpleasant surprise awaits you when you exit.

The AI creatures are assumed to be aware of the entire map lay out, it's only the players' position they don't know about unless there is visual contact.

Today's progress includes that if a croc doesn't explicitly see a player entering a short cut, but sees him dissapearing into a corridor that leads to a short cut, it will still be able to figure out what might have happened.

Thank you. Even coming from someone with [/sarcasm] in their sig it means a lot to the crocs, they send their regards.

Update 13I gotta say, today was a good day. Not because I was very productive, but because I tested stuff and it worked.

I made this crazy level:

and had two crocs plus four A-creatures run around on it, along with a player. Implemented that if a player touches an A-creature it dissapears and a score counter increases, no animations and no nothing, but still enough to start trying stuff out soon. It's a game!

The crocs adapt well to different environments. They are able to navigate a maze like this without looking too clueless, at least to me.

One thing I've started to notice about how the game turns out is that there is much more emphasis on not being seen by the crocs than I had anticipated. For some reason I imagined that the Crocs would know where you were pretty much most times, and the gameplay would be about hunting/fleeing. Unless I want the Crocs to see through walls this is not really possible though, if you're behind a wall you're behind a wall and the Croc shouldn't know your exact position.

The hunt/flee type of game play had a problem, if the croc would constantly be chasing the player I pretty much would have only two options: Either the croc is slower than the player, and will never ever pose any threat because it's unable to catch up. Or, the croc is faster than the player, and will catch up and kill you within a very limited time, no way to avoid it.

As it looks right now the game is leaning more towards a platformer/sneaker than an action platformer as I had originally planned. I have nothing against this, if that's the direction the project wants to go I'll allow it. I like the feeling that the crocs are physically superior to you, they outrun you easily, the only way to survive is to out smart them. This is a perspective I think is fairly rare in games. (Actually your only advantage to the crocs is your overview, if your vision was as limited as theirs you would be A-B-S-O-L-U-T-E-L-Y C-H-A-N-C-E-L-E-S-S, but it feels as if you're out smarting them!)

Ok, it'll be a long post today.

You see the little yellow things on the level editor screen shot? Those are hives. I felt that the C-creature had an objective, eating the B-creature, and the B-creature had an objective, eating the A-creature, but A was without any motivation. What would it do, just hang around one part of the map until it got chased to another part of the map? I wanted it to do something.

The hives are places where A-creatures spawn, and then during their life time they move around from one hive to another as if transporting something or what will you. This makes them motivated to go somewhere instead of just roaming by random. The behaviour looks a bit ant like, they have their paths between the hives where they move back and forth, until a player chases them and puts them off their course.

The idea is that they should be able to dive down into their hives and dissapear, so that the player has to ambush them on their routes instead.

Unlike the other creatures the A-creature will be respawned when killed, and therefore needs a logical respawning place instead of just popping up from nowhere.

The path finding seems to be more or less behind me and hopefully the pace will increase from here on! Soon I'll make a video or demo or something so you can see the stuff in motion.

It's becoming a game! All the creatures are in and behaving somewhat like what I want them to. I've been thinking about about the game rules, here's what I came up with:

1. Catch as many A-creatures as possible within a limited time.2. Survive! No respawns.

The idea is that I want a basic mechanic that's the same for a multi player game and a single player game. The "high score" of a level will be the amount of A-creatures eaten within a certain time, and you can attempt to break these records, for some single player replay value.

Multi player: There is a timer, urging players to hunt rather than just sitting around in some corner. When a player dies he is not respawned, but the timer is halved, so that you won't have to sit around inactive for ever and ever. The gameplay is less interesting for all players when one is dead, but the surviving players should be given just a little extra time to gain an advantage and compete among each other. The amount of time I'm thinking about is two or three minutes, the multi player game mode should be fairly rapid-fire paced with new levels every so often. This is especially important as there are no respawns.

The players are ranked from how many A-creatures they managed to eat in their lifetime, but a surviving player is always ranked above a dead one. This means that there can be no situation where you benefit from committing suicide. If all players are dead the one with the most "eats" will be the match winner, but if there is one surviving player he will win, despite not having catched a thing. So, the priorities are: 1) Don't get eaten. 2) Eat as much as possible.

Single player: The basic mechanics are the same, but the winning condition for a single player level is 1) Being alive, 2) Having eaten a certain number of A-creatures. If you manage those the next level will unlock or however the campaign will be laid out. In the campaign there could also be levels where you're supposed to just get to an exit like any platformer, the high score of those will be how fast you got there.

Possibly there could be some kind of co-operative mode where two or more players play the single player campaign, and their score is added up and then divided by their numbers or something like that. We'll see what's reasonable.

I'm currently setting this framework up, and will soon try it. Some (most) things might be revised.

Yesterday I saved a version of the game and tried on another computer, seemed to work fine. The import of text files and export of .png files worked too, which was a huge relief.

The level editor will probably save a level as an image file, which will contain the level image as well as the level data, the latter coded into a block of different-colored pixels which will look like noise to the human eye. This is probably not the optimal way to do things, but it compresses the entire level into one file, which is nice.

Glad to get something up here that isn't just another wall of text, hope you'll find it interesting! If I have any readers left, that is...

In other news saving level data in a noisy square in an image seems to be working fine, which I'm rather happy about. Soon I'll move the level drawing code over to the level editor, and then I'm set to start working on the graphics.

Before you get excited/dissapointed, keep in mind that this is my very first pixels I ever draw for this game, it is much more likely that it will end up looking nothing like this than something like this. However, a first tiny step towards working on the visuals has been taken.

It's nice to have art in the dev log, now I might actually have read it myself!

Since the main thing making the game easy already is the croc not knowing where you are, the limitation is more in terms of not being able to see backwards rather than only being able to see forwards. Anyways, this allows you to wait in a side tunnel for a lizard to crawl by, and then crawl out behind it and get away.

You see the little bulge of vision covering the tail? If the point that's tested is close enough the angle is not tested, to simulate some kind of spatial sense and so that the player can't crawl into its tail without being noticed.

In an open level like this a lizard in the right position can cover huge areas, and two of them can see pretty much the whole level.

I think this works well, because open areas are not the crocs' favourite environment to move in. This creates a balance - close quarters: they won't spot you, but if they do you're done for. Open spaces: they'll spot you, but you have a fair chance of getting away.

Update 16Gave the lizard hearing. To keep things simple and clear to the player the only thing that can cause a for the lizard hearable sound is landing on a floor after being airborne. If you make the tiniest possible jump by just tapping the button you'll make no sound at all. The variable of lizard hearing is how big the radius is within which it'll register this sound.

It doesn't know where you are, as when seeing you, and it doesn't know which player it heard. All the sound does is that if a croc is idling or snooping around and hears a sound it'll go to the place the sound came from to check it out. When chasing a known target it'll ignore sounds.

It is communicated to the player that a croc heard something in the way that it stops in its tracks for a second, as if listening. Once it eventually gets a head it will probably turn this towards the source of the sound as well.

Made the croc able to kill the player. Not eat, that's a matter of animation and will be attended to later, but magically kill on touch. The croc is now able to lash out to a close by player, making it impossible to jump over it on a floor.

As I mentioned the croc is already slower than you out on open floors, and that together with you being able to jump and it only being able to turn made it possible to jump over its head again and again for ever. The new mechanic means that you can't do that any more. You can still jump over it by using a wall though.

Almost all the mechanics I imagined for the game are in now, but there's a lot of number tweaking to do. However, I feel that I'm finally at the end of the huge chunk of this project that has been the croc AI, and hopefully no other part will take as much time. There will be a revisiting to this though, when I have a little less schoolwork to do so I can try the game out with a friend. I have no idea how the crocs handle multiple players, it could be just fine, it could be in need of some redesign.

It's too hard to cath the A-creatures, need to tweak that a bit. Another thing I was thinking of was that maybe the player shouldn't eat the creatures on touch, but rather just catch them, and then you have to go find a safe place to consume your prey. I like this idea, will have to see how it plays out in reality.

Been thinking a lot lately about how I will render levels. Have some kind of semi-voxel idea going on, more on that later. However, with level rendering comes art, and with art the devlog becomes interesting! Hopefully the daily five page essays on how a virtual lizard finds its way around a maze has finally come to an end... A brighter future awaits!

You see how it paces back forth a little bit at times? That's when the path is being calculated. I don't want it to be standing still during this process, because its speed will be a que to what behaviour it's engaged in. I prefer that it runs back an forth as in a bit of initial confusion, then suddenly realizes what path it'll take. Path finding speed is a stat, and some lizards may be slower than others.

Moved the level rendering code over to the level editor, and overhauled it completely. The system is now working in a semi-voxel kind of way, where one tile is 20*20*10 pixels. I also made the level editor able to save a level in the format that I think will be final. Didn't try loading yet though... The level seems to be very light, so I'm happy about that.

The voxel format allows me to do some interesting stuff such as fog and light...

This is just 20 minutes of coding to test it, but I like the potential it has. Because of the voxels I don't have to create separate solutions for everything, stuff sorts itself out automatically. If you look at the detail in the lower right corner maybe you can imagine what a hassle it would be to calculate how the shadows would look in every special case like this, now it just works by itself.

It's flawed, yes, I have noticed the stripy floors. Also it will demand some patience, rendering it pixel by pixel will take a minute or two for an entire level. But I see a lot of potential in it!