Mark Sachs (ksleet) wrote,
Mark Sachs

  • Mood:
  • Music:

You ask one if he want ice-cream, they both say yes.

Ok, some Neon Galaxy stuff for you today as promised or at least vaguely implied last time.

The first enemy to be implemented in Neon Galaxy is the Solid Fuel Drone. (If you're among the three people in the world who played Combat, one of the first games I worked on professionally, a similar enemy exists in that title as well.) The SFD wanders randomly around the maze until the player comes within its detection radius. It will then point itself at the player and light the engines. At that point, it flies straight until it crashes into the player or another object and is destroyed.

Though they're quite simple, implementing these guys was a useful exercise as it stressed parts of the AI system in a way that test data did not; I had to add some behaviors and fix some things here and there to make it all happen, things which I just hadn't thought through fully in the context of an actual game. Under the hood, this is how it's set up:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
				<navigate type="random" name="wander" />
				<navigate type="target" name="pursue" />
				<and name="attack">
					<setmovement maxspeed="450" acceleration="300" turnrate="60.0" />
					<setflag flag="0" />
					<navigate type="target" />
				<navigate type="straight" name="attack_losttarget" />
				<and name="hitplayer">
					<collisiondamage hp="1.0" entity="PlayerShip" />
					<explode />
				<explode name="hitnonplayer" />
				<collide target="hitplayer" entity="PlayerShip" />
				<and target="hitnonplayer">
					<checkflag flag="0" />
					<collide />
				<fandetection target="attack" range="300" width="5" entity="PlayerShip" />
				<checkflag target="attack_losttarget" flag="0" />
				<circulardetection target="pursue" range="300" entity="PlayerShip" />
				<true target="wander" />
	<movement maxspeed="75" acceleration="100" turnrate="100.0" />
	<graphics file="model_drone.xml" />
	<physics radius="10" friction=".02" />

The most interesting as well as the most complicated part by far is the AI section, which turns out to be a surprisingly large set of behaviors and conditions. As I've mentioned in the past, this AI system works by marching down the list of conditions every frame, and once it reaches a true condition, immediately executing the target behavior. Thus, the order in which I've presented the conditions to the computer is very important. Translated into English, here's how the drone works:

1. Did we hit the player? Explode and do damage ("hitplayer" behavior).
2. Did we hit something else? Just explode ("hitnonplayer" behavior).
3. Have we successfully locked on to the player? Begin the attack run ("attack" behavior, which sets a flag on the AI so that we know we started the run).
4. Were we locked on, but we've lost sight of the player? Keep accelerating anyway ("attack_losttarget" behavior).
5. Is the player within visual range? Try to lock on ("pursue" behavior).
6. None of these conditions are true? Just wander the maze ("wander" behavior).

So it works as designed, but I do have to say the SFD is not an especially tough foe. They were actually quite dangerous in Combat because they could see the player and begin their attack run from any distance as long as there was an unbroken line of sight, and since the game was third-person you couldn't see them if they were coming in behind you. By contrast, the detection range for the drone in Neon Galaxy is much shorter and since it's 2D you have full awareness in all directions. I'm thinking I may crank up the detection range quite a bit, so you can get drones sailing in at top speed from offscreen. I'm inclined to move on to the next enemy for now, though.

On a more artistic note, I'm trying to set up a unified color scheme in this game. The idea is:

WHITE indicates the player, maze walls, and other basically neutral things that won't hurt you.
RED highlights indicate enemy vehicles or structures, such as the drones.
YELLOW highlights indicate anything which is bad for you if you touch it. In this case, the drones have yellow highlights as well as red, because running into them is harmful. (Many enemies will not cause damage simply by ramming, so we need to make that distinction clear.) Enemy bullets will also be yellow.
GREEN highlights indicate something that's good for you. Powerups, mostly, but the exit will also light up green once the reactor is destroyed.

Hopefully that'll make it easy to pick out what you need to see even if the environment gets chaotic. As for being attractive, I'm frankly not confident in my art skills where games are concerned, but we'll just go ahead for now and see how that turns out.
Tags: neon galaxy, programming
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.