Game Scripting – Part 1

Today I bring you something I’m pretty excited about: part one of a multi-part guide on scripting for Arena.

We’ve sort of been hiding this feature, but we’re ready to talk about it now. Our Battalion Map Editor in Arena now supports scripting. What does this mean for you? It means that not only could you be making your own Battalion maps, but you could be telling your own Battalion story as well. Scripting will let you program action into your maps so you can create the kind of Battalion action that we whipped up for you in Battalion: Nemesis. In addition to being able to draw up maps for straight multiplayer combat, if you’re willing to roll up your sleeves and get into some code, you can really craft up a masterpiece experience.

So let’s get rolling. Here’s scripting in a nutshell.

Introduction

Events

Scripting exists to create events inside your Arena level. An event is defined by a condition and a response to that condition. Another way to think about this is if/then. If A happens, Then B happens. So, for every scripted event you create, you’ll want to create a condition, and then set a response to that condition. Simple so far, yes?

Events are the chunks of action that you want to place in your level. Want some dialog to appear? You’d do that inside of an event. Want an enemy unit to arrive? An event. Want to award resources? Event.

Conditions and responses are the when and what for your event. I’ll explain.

Condition

The game won’t know by itself when you want your events to take place, so you have to tell it. This is a condition. You say, “Hey Arena! When Player 1 destroys unit X, do something.” or “When Turn X hits, something happens.”

Every event only has a single condition. That’s not true, really… but we won’t get to handling multiple conditions for some time. For now, it’s best to think of it that each event is 1 Condition, and as many responses as you’d like.

A quick example in plain English (we’ll add in the code itself starting next week).

Event

Condition: At Turn 25

Response: Build Annihilator Tank for Player 2

See? Very basic. A condition sets when you want something to happen. What triggers your event.

Response

A response is the game’s reflex when a condition is reached. In the above example, when turn 25 begins, the game will immediately build a unit for Player 2. It’s an automatic reflex response.

While an event, to start, only has one condition, it can really have as many responses as you like. Maybe at turn 25 you want a unit built, but you also want the Player 2 General to say “Ha! My reinforcements have arrived. Your demise is assured!”. That’s fine. You would simply add another response to your event. Now in plain english it will just look like this:

Event

Condition: At Turn 25

Response: Build Annihilator Tank for Player 2

Response: Player 2 says “Ha! My reinforcements have arrived. Your demise is assured!”

It’s that easy.

Next Week

Next week we’ll get down and dirty with scripting. I’ll start to show you the code to make it happen. We’ll start by turning my plain text example above into actual scriptable events and you’ll see how easy it is.

Post Metadata

Date
July 20th, 2009

Author
scarmichael

Category

Tags


1 Trackbacks & Pingbacks

  1. August 27, 2009 7:48 pm

    multi game :

1 Comments


  1. KingGrimmjoq

    interesting this sounds like fun


Leave a Reply