Previous Blog Next Blog
Prev/Next Blog
by date

One of Two - AI update.

One of Two - AI update.
Name:Phil Carlisle
Date Posted:Feb 01, 2006
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Phil Carlisle

Blog post
Warning! Image heavy!

Well, the AI pack is still rolling along. Was it last week I posted about a little epiphany I had about adding triggers to give level designers more control of how a level plays?

Well, let me explain the trigger concept a bit more and maybe give some example scenarios.

Triggers are simply objects you can put in the game (using the world editor) to control gameplay elements. They are in essence, simple logic devices which control simple but powerful functions which when added
together allow you to create some pretty funky gameplay. The big advantage here is that it is totally *without* using any scripting.

That's right, you can setup different team based gameplay, single player play, in fact a lot of interactivity in your levels without touching a single line of script!

How does it work?

Well, there are a number of triggers, each with a different set of core logic that controls when they activate. When a trigger activate it usually either activates another trigger in a chain, or changes a
property of an object or (and perhaps most usefully) causes something to be created or removed.

Triggers have been used in gameplay in half-life for years and are a pretty simple concept once you see them in use.

So lets cut to the details, here are a few example trigger icons (made by Logan Foster thanks logan!) that you will be able to place in a scene:

Basic_Trigger



This trigger is the "basic" type trigger. It can be used to activate other triggers, it can remove itself on activation, or reset itself, has options for being timer driven (so it activates every N seconds) it can
be set to only trigger N times, it can be set to activate after N other activations have happened (i.e. count up). It is the basis for the other triggers.

Volume_Trigger



The volume trigger adds to the basic_trigger the notion of volume. This means that the player can "touch" it. It can activate when players enter it, when the exit, or while they are inside. Again counters can
determine how often it activates etc.


Trigger_Multiple



This trigger is based off Basic_Trigger but adds the ability to activate multiple (up to sixteen) other triggers when it gets activated. Essentially its used to multiply the input into multiple outputs. See the example below.


Multi_Trigger



This trigger waits for multiple triggers to be activated before it activates. Think of it as a simple counter.

Spawn_Trigger



This is one of the most useful triggers. This basically acts like a "monster factory" creating the given creature by defining its mesh, brain, player class etc. This allows you to create creatures, spawn new
ones when those die, spawn new ones at a given interval, spawn up to a max count etc.

Additional Level Description Entities

Game_Team_Master

Each trigger has a "master" value, which is the id of a Game_Team_Master, which means that only players on the given team can activate that particular trigger. This is useful for team-specific doors
or switches for instance.

This trigger master, acts like a label to a trigger, it essentially says that "this team owns me".

World_Spawn

The World_spawn entity and the Game_Team_Master work in conjunction to describe (in the world spawn) the number and names of teams and (in the team masters) the names of teams and their id.


Given these objects, we can create plenty of interesting level scenarios just by combining these simple objects. Here's an example.

Say I'm working on a WW2 FPS game (heaven forbid) and I'm trying to recreate the DDay landings. Here's how I might use some triggers.

I have a trigger that is set to trigger once at the start of the level, this activates a trigger_multiple which then activates a bunch of different things. Several of those are to spawn the landing craft which are AI vehicles which are given a specific path to the beach. In addition, there are triggered another trigger multiple which starts firing explosions off on the beach. Once the players landing craft lands, it sends and event or touches another trigger which fires off a multiple which triggers all of the german defensive spawn triggers.

These spawn enemy gun units which man the gun emplacements and begin firing.

In addition to the spawning of gun emplacements we can also spawn in some enemy Stuka's which are AI Based flying vehicles which are there to basically bomb the beach.

Assume that the end condition for the level is to reach a given bunker on the top of a slope and to do that you have to destroy a door. So we add a trigger volume to the inside of the bunker that signals end of
mission (A trigger_changelevel), but in order to create the door, we have a trigger_breakable that when a particular interior is destroyed we class as destroyed, which then spawns some final enemies inside the
interior, the player fights their way past the final enemies (spawned when the door dies) which give the final element.

The point about all of this, is that there is not a single line of user-created scripting here. This is all created in the world editor.

That's not to say that its any more flexible, because scripting could easily do all this stuff, but what the trigger system provides is a way to quickly and visually setup logic based scenarios in a manner that many level designers are used to.

So I hope you'll agree that this system might be a useful addition to TGE's ease of use.

Next time, I hope to have a demo video of a typical setup based on our demo missions for the AI starter kit. It will include a simple setup showing you how easy it is to build a more interactive level using this trigger system. That coupled with our event system and it should be super-powerful for the simplicity involved.

Until next time.

Phil.

Recent Blog Posts
List:09/18/08 - Tell me I'm not going crazy!!
12/05/07 - The importance of good tools for productivity
11/17/07 - Using the way back machine.
09/21/07 - Juggling cats.
09/04/07 - End of Summer.
08/27/07 - Come work with me!!
08/14/07 - The changing nature of entertainment
07/25/07 - Someone stole my notes!!

Submit ResourceSubmit your own resources!

Allen Turner   (Feb 01, 2006 at 22:50 GMT)
This is looking better and better. I can't wait to sink my chops into it. It's the kind of thing that indie engines have been lacking for a looooooong time. Kudos to you and keep those updates coming!

-Allen T.

Pat Wilson   (Feb 01, 2006 at 23:04 GMT)   Resource Rating: 5
Damn that is sounding really cool, Phil!

Timothy Aste   (Feb 01, 2006 at 23:13 GMT)
Freaking A, this looks and sounds amazing. A level designers dream come true. Where can I sign up?

Canon   (Feb 01, 2006 at 23:33 GMT)
Phil, I will be one of your buyers!!!!!!!!

Christophe
www.frogames.net

Logan Foster   (Feb 01, 2006 at 23:53 GMT)
Tim actually thats what I was thinking when I responded to Phil with a 5 page document on wishes and items that I thought that the AI pack needed to do and how it worked (as per Phils .plan request and subsequent IRC chats). Having used the original iteration of the AI pack I found personally that it was too code dependant and didn't have enough of that "level designers" integration to it. So far though from what Phil has done with this latest AI Pack iteration it looks to be the both of best worlds, easy mission editing along with the ability to get in there and hack at its code guts if you are so inclined.

Treb Connell (formerlyMasterTreb   (Feb 02, 2006 at 00:47 GMT)
Seems very easy to use and also very fitting into different types of games which is exactly what the AI pack needed.

Vashner   (Feb 02, 2006 at 07:10 GMT)   Resource Rating: 5
This is looking good ya'll.

Michael Cozzolino   (Feb 02, 2006 at 13:14 GMT)
This is great Phil and who ever else is contributing. I'm really looking forward to see the innards of something like this in a real world application, not examples in a book. I will buy as soon as I see it for sale.

Chris "Tribal"   (Feb 02, 2006 at 18:10 GMT)
excellent , been following your updates for awile.
quote "This is all created in the world editor." , dreams do come true.

Tom Bentz   (Feb 02, 2006 at 19:00 GMT)
Looking slick!

Uiriam   (Feb 15, 2006 at 09:23 GMT)

Edited on Mar 31, 2006 14:33 GMT

Dave Young   (Feb 16, 2006 at 22:42 GMT)
Very interesting, broadly useful. Keep it going!

Duane Clark   (Aug 19, 2006 at 02:30 GMT)
Just wondering how this is going?

Edward   (Mar 26, 2007 at 22:24 GMT)
any update on this?

You must be a member and be logged in to either append comments or rate this resource.