Monday, 10 December 2012

Welcome to Slamjet Stadium!

Galaxyball 2113 has a new title - it's now Slamjet Stadium and I'm so excited about how it's going!

The video below gives a brief rundown of how the game's played, so hopefully you can get a feel for what it's like in action.


Guess who's been making A.I.! 

Since my last post I've been putting a lot of work into the AI and then user interface. I've had a lot of fun doing the AI in particular - there's something oddly delightful of coding a game and watching it play by itself. I coded AI for Greedy Bankers vs The World, and it's fascinating how different the two implementations are.

A pair of viable moves in Greedy Bankers - this will make the 2x2 purple gem grow to 3x2
Bankers was very combinatorial - that is, most of the work went into building a routine for actions to check through, like a giant flowchart. It checked through every gem on the board, kept a note on the most viable, found a gem that would help make it bigger, and then pathfind a route to the best place to put that gem. Should one choice of gem prove infeasable the AI moves on to the next. The hardest bit is making sure that - to your best knowledge - there's no situations where the AI wouldn't know what to do. Or indeed have a really obvious action in front of it that it cannot recognise!

The green player aims to be behind the ball so that it has a clear shot at the goal. The text and coloured icons help me see what each player's AI is trying to do. In this case, green means "attack" and yellow means "defend"
Slamjet Stadium's AI is very different, in that there's fewer game elements on the board for the AI to worry about. An AI controller is attached to a player character, and its main concern is its location relative to the ball, and the ball relative to the goals. Attacking AI needs to line itself up so that the ball is between itself and the goal and it can make a clear shot, while defending AI mainly aims to sit between the ball and the defending goal.

Propelling the player through the ball will cause an own-goal, so it needs to find its way around the outside
The hard part here was making sure it can propel itself to a specific part of the arena - after all, it's a physics-based game, so friction, mass and propulsion forces all need to be considered. After a recap on A-level Maths I managed to work out a system for calculating the correct charge to apply to a player. Even when this is done, however, there's still plenty to do. The AI needs to correct for its current velocity, so it can aim accurately at the ball even if it's already moving. It also needs to make sure to go around the ball to get to the back, rather than try to go through it and risk an own goal.

A point of note is that I never studied AI at university (I was a Maths student!), or indeed read up on it before attempting coding these systems. If your game is based around new or unusual mechanics the chances are there's not solutions up online for you to read from - don't let that put you off if you want AI in your own game. Think through how you play your own game and divide it up into each little decision you make. Build each of these decisions into the AI one by one, and any sticky areas will make themselves obvious as it comes to life.

Trust me - you'll be glad you gave it a shot!

1 comment:

  1. Different organizations offer distinctive setup expenses on auto credits. In view of setup expenses, it is chosen that how shoddy your auto credit is. Thus, do check the set up charges of different advances. cash advance chicago

    ReplyDelete