Battletech Event Editor / Data Driven Gameplay

Published September 24, 2017
Advertisement

BattleTech is going to have a Random Event System during the single player campaign. Basically as time ticks by, there's a random chance for these events to popup during the time between combat missions. You're given a situation and a handful of options to choose from. Some options may not be available based on previous events, contracts, or other game play. Based on the chosen option, a result set is chosen at random (weighted) and the results of that are applied. 

I recently delivered the event editor for our game so the designers could crank out events at a faster pace. Originally, it was hand edited json. Then it was a simple text format that Kiva wrote a python parser for to convert that text into json. Now it's a WinForms app with a gui, validation, and other utilities built in. The designers have been using it for a while now and so far they're really happy with it. Here's a screenshot of the main editor and one of its subforms.

EventEditor.thumb.png.4612364338d7e0126c9a1cd1f81951ae.png

Event System Data Model

Events - Have a Title, Description, Image, Scope, a list of Requirements, and a list of Options. The Scope tells us which main object we're going to be dealing with (typically Company or Mechwarrior). The requirements say what must be met in order for this event to be pulled. And the options are the choices the player makes when they see this event.

Option - An option is a choice a player makes. It has some text, a list of Requirements, and a list of potential Result Sets. Choosing this option randomly selects one of the result sets.

Result Set - Is what gets applied as an outcome to the event. It has a description, a Weight, and a list of Results. The Weight influences the randomness of the outcome. If we have two result sets and one has a weight of 75 and the other a weight of 25, then the first Result Set has a 75% chance to be chosen.

Result -This contains all the data that happens as a result of the event.  Added Tags, Removed Tags, Stat Modifications, Forced Events, Actions, flags for a Temporary Result, and its Duration. This is how the game world gets modified. You can add a tag to the Company Honorable, Remove a cowardly tag from a mech warrior, give a star league era Gauss Rifle, or force an event into the queue for later. 

Requirements - Requirements have a Scope, a list of Required Tags, a list of Excluded Tags, and a list of Comparisons. The scope tells us what we're looking for. Any Required tags must be on the object. Any excluded tags most NOT be on the object. And any Comparisons must be met. For example: Scope: MechWarrior, Required Tags: Marik_Origin, Excluded Tags: Cowardly, Comparison: Injuries > 0 - would look for a wounded Marik pilot who is not a coward. 

TagSet - A list of strings attached to various items in our game (maps, encounters, contracts, company, mechwarriors, mechs, etc.) It's a simple concept, but very powerful. Many things are setup with an initial set of tags, but we also add tags to your Company, and your various mechwarriors. These are then querried on by events and other systems in our game to make the world feel more alive.

Data Driven Content

I'm a big proponent of using data to drive applications (game or not) because of all the benefits it provides. The major benefit here is being able to add content to your game without access to the source code. When done correctly, it opens the doors wide for a modding community to take your game into new directions and it can really add some longevity to a title.

The event editor will be included in the final version of our game and I'm excited to see what events they'll come up with. :) 

 

- Edited to talk about what the event system actually is so people don't get confused about "event programming". 

5 likes 2 comments

Comments

ferrous

Nice!  Mildly surprised to see WinForms.  Not a bad thing, as I always loved WinForms for it's simplicity, even if it's uglier to look at than a WPF  or XAML UWP app.

I am really curious about the Event system used in-game.  I've never been completely happy with any of my event systems inside Unity.

September 25, 2017 04:11 PM
Eck
Eck

Time was a factor and WinForms is what I knew from the olden days. By the time WPF became a thing, I was still on a legacy ASP.Net project for a big client that couldn't switch technologies. I never got around to picking it up. 

So far the event system is pretty cool. It's still coming online, but I'm really liking what I see. :)

- Eck

September 25, 2017 09:35 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement