Laserbrain Studios

Games Forum Blog Contact

Archive

Music and sound

3 Comments August 27th, 2012 by Christian Knudsen

Last week I decided to take a day off from working on the AI and get the basic sound framework implemented. That one day ended up becoming the entire week, and I now have both music and sound completed for the demo. There are currently 20 sound effects in the game. They’re all what I call functional sound effects – such as footsteps, doors opening and closing, gunshots and so on – and I still need to add mood effects – for example wind blowing, the hum of traffic or dogs barking in the distance. There are only 3 pieces of music in the game for now, one of which is the main menu music. The other two will play when the action in the game calls for it: sneaking around or being under attack. So it’s basically situational background music.

I was planning to do a video this week, but my computer can’t record internal sound. So I’ve ordered a minijack to minijack cable that will allow me to plug the computer’s sound output from the headphone port right into the mic port. I’ve also ordered a better microphone for recording my voice. Hopefully this arrives this week so I can do a video for next week’s update. For now, it’s back to AI programming…


AI searching and chasing

1 Comment August 20th, 2012 by Christian Knudsen

I got two big AI algorithms implemented this week. Originally, I had planned to have the searching and chasing algorithms combined in one, but it turned out to be easier to do if split into two separate algorithms.

With the chasing algorithm, the AI will remember where the target was last seen and which direction it was moving in. The AI will then move to this tile and continue chasing in the direction the target was last seen escaping in. If no new visible contact is made with the target, the AI can start checking doors or side corridors it moves past, while continuing to chase in the direction it suspects the target may have run off in (if the target could have escaped in two different directions, for example, and one of these directions was outside of the AI’s line-of-sight at the last ‘waypoint’, the AI will continue on in this direction, as the target would likely already have been spotted if escaping in the direction that wasn’t hidden from the AI).

The searching algorithm is a bit simpler: the AI will just choose some random waypoints within a certain distance from the central search tile, then go to these in turn, stand there for a moment and look in different directions before moving onto the next waypoint.

With both of these algorithms, I ran into an issue when the AI’s path was blocked by a locked door. The AI character would just stand there indefinitely. So I also implemented a procedure for checking if an AI’s path is blocked by a locked door or non-moving character – and then abandoning the chase or moving to the next search waypoint if blocked.

The overall structure that governs each AI character’s behavior is made up of separate orders. A character will usually start off with just 1 order, for example patrolling an area, standing at a counter or just walking across the map. Certain events can cause a character to get a new order, such as when a patrolling guard spots the player. Instead of overwriting the old order, this new order is just stacked on top so the character now has 2 orders (the orders for each character are just stored in a dynamic array). When executing orders, the code always executes the last order in a character’s order stack. And when the current order is done (if the guard has lost track of the target he was chasing, for example), this order is just removed and the previous order becomes top of the stack again – meaning that the guard just returns to his previous order and goes back to patrolling.

It works really well and isn’t all that complex coding-wise, so I’m pretty happy with this solution. I haven’t really read up on AI programming theory, so this may all be pretty basic or incredibly stupid, but hey, it works for me!

I’ll probably be making a new development video demonstrating the new AI stuff in a week or so. Stay tuned for that.


Laserbrain Forum and some AI work

3 Comments August 12th, 2012 by Christian Knudsen

Work continued on the AI last week. I’ve implemented sound checks for the noise you make, so NPCs can now react to your footsteps and gunfire if they’re within range of hearing you (the further away, the lower the risk of them hearing it). So sneaking is going to be very useful now for moving around without making too much noise. I only have the crouching animation done, so for now, crouching will be as silent as sneaking (in the finished game, crouching will be used for moving without being seen, and sneaking for moving without being heard).

I’m diving into the searching procedure now, which will be used if a guard hears you without being able to see you, or if an NPC for example finds a corpse and should check the nearby surroundings. It basically just sets some waypoints for the NPC to go to within a certain range of the corpse or where the sound came from. There are some complications to it, though, such as being able to check rooms lining a corridor, if the NPC last say the player run down said corridor, for example. I have some ideas that I’m currently trying out.

In other news, you may have noticed that I’ve set up a forum. Along with that, I’ve disabled blog comments and instead integrated the blog somewhat with the forum (blog posts are automatically posted to the forum, and the blog post displays how many comments have been made on the forum along with a link). I wasn’t able to migrate the WordPress users to SMF users, so I’m afraid you’ll have to register for the forum even though you previously registered for the blog. Anyway, see you on the forums!


Sprite assets galore

3 Comments August 6th, 2012 by Christian Knudsen

I spent most of last week making the sprite assets I was missing for the test map. So I bunched them all up in the parking lot, just ’cause…

Click to enlarge

The new assets are:

  • Toilet
  • Sink
  • Urinal
  • Hand dryer
  • Toilet paper
  • Water cooler
  • Coffee table
  • Conference table (in sections so it can be any length)
  • Cardboard boxes (2×2 and 2×1 tiles in size)
  • Fences
  • Various new walls and windows

Now it’s back to AI and map design!