An Introduction To Terrarium - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

An Introduction To Terrarium

Description:

The aim in Terrarium (the game not the coursework! ... Articles online (and on the module page) Journals and books from the library ... – PowerPoint PPT presentation

Number of Views:403
Avg rating:3.0/5.0
Slides: 36
Provided by: paultr6
Category:

less

Transcript and Presenter's Notes

Title: An Introduction To Terrarium


1
An Introduction To Terrarium
  • An Ex-Students Perspective

2
Terrarium The Basics
  • Real-time game of imperfect information
  • You control a bug that lives within a
    Terrarium
  • Current information about the environment is
    restricted to the area immediately around and in
    front of your bug
  • Lots of bugs can inhabit the same Terrarium at
    once

3
Virus vs. Terrarium
Virus Terrarium
Turn-based Real-time
Perfect information Imperfect information
Interact using an evaluation function Interact using rule based DoAction()
2-player Multi-player
Short games speed essential Longer games speed less vital
4
Virus vs. Terrarium continued
  • Those who found Virus evaluation function based
    approach confusing or counter-intuitive may find
    Terrariums rule based approach easier to use
  • If two Virus players didnt use random numbers at
    all they would always play the same game
    deterministic
  • If two Terrarium players dont use random numbers
    at all there are still random elements outside of
    their control non-deterministic
  • Less tuning and optimisation of variables
  • More strategy and planning more scope for
    creativity (but only in my opinion!)
  • I personally enjoyed Terrarium more than Virus

5
Whats a Terrarium?
  • An area surrounded by obstacles within which bugs
    can move and perform actions
  • Terrarium Academic includes bugs, rocks
    (obstacles), plants and goals
  • Objects are solid
  • Objects have different sizes

6
(No Transcript)
7
Terrarium Bugs
  • Bugs are introduced into a Terrarium and perform
    actions based upon their code
  • Code (should be!) arranged so that the bug reacts
    to its surroundings
  • A set of pre-defined methods and variables are
    available to write bug code
  • API should be helpful and easy-to-use
  • Tool-tip text for all applicable methods and
    variables

8
Bugs continued
  • Your bug (and all bugs) have certain attributes
    you can access, e.g.
  • Health (Vital!)
  • Score (Important!)
  • Position
  • Speed
  • Direction
  • Kills
  • And others

9
Ticks And DoAction()
  • A game of Terrarium takes place in real-time, but
    is still divided into turns
  • A turn is referred to within Terrarium as a
    tick
  • Each game is comprised of many ticks
  • Every tick, each bugs DoAction() method is
    called
  • This method is where you write you code
  • It tells your bug what to do for the next tick
  • Where to move, what to eat, what to attack etc.

10
Ticks And DoAction() continued
  • Within your DoAction() function you must write
    code that looks at whats going on around your
    bug and what condition your bug is in, then makes
    a choice about what to do next
  • Your method is called within it you call other
    methods that will make your bug perform actions
    like eating and fighting
  • You can write your own methods to call from
    DoAction(), and you can use several built-in ones
  • Make choices based on the environment and the
    variables that describe your bugs current
    condition

11
Whats the Point?
  • The aim in Terrarium (the game not the
    coursework!) is to get a higher score than all
    the other bugs in the Terrarium
  • Score points in two ways
  • Kill opponents
  • Collect points from Goals
  • Goals can be hard to reach, difficult to find or
    in dangerous locations!
  • Other bugs probably arent going to just roll
    over and die!

12
Points from Goals
  • Goals have a fixed payout
  • When a bug collects the points from a goal, it
    turns red (inactive) for an amount of time
  • Fixed Time
  • Random Time
  • Points

13
Points From Bugs
  • Killing a bug by reducing its health to zero
    results in you getting half of its points
  • Killing blow is the only one that counts!
  • High-scoring enemies vs. low scoring enemies
  • Balance and compromise

14
Staying Alive
  • Health is reduced through combat
  • When you get attacked health decreases by a
    random amount find out how much yourself!
  • Defending can reduce the damage taken in combat
  • But! Can only defend against one bug at a time!
  • Counter attack fighting back
  • Again, can only attack one bug at a time
  • Can both defend and attack simultaneously

15
Staying Alive continued
  • If victorious in combat youre still likely to be
    injured
  • Health does not regenerate naturally
  • Have to eat!
  • Plants and dead bugs are both sources of food
  • How much is healed per unit of time is again left
    to you to discover (Im still not sure!)

16
Staying Alive continued
  • Plants are static
  • If you saw it once, itll still be there next
    time!
  • When close to a plant you can order your bug to
    eat it
  • Your bug will recover some health
  • The plant never dies and is never eaten up
  • Plants are also always active unlike goals
    that need time to recharge before they give
    points out again

17
Staying Alive continued
  • Clever strategies for combat are helpful and
    encouraged
  • Sneaking up on opponents
  • Lying in wait
  • Camping at good spots
  • Preying on the weak (mean but effective)
  • Avoiding combat entirely
  • And many, many more

18
Ticks And DoAction() Again
  • Very simple example
  • Your bug is injured and there are no other bugs
    around
  • A plant is nearby and is in a quiet and safe
    position
  • Probably a good idea to go and eat it!
  • Call method to move towards plant
  • On each subsequent turn, check if youre close
    enough to eat it
  • If so, start eating it!

19
Ticks And DoAction() Again
  • More complicated example
  • Your bug is moderately damaged and there are no
    bugs in the immediate area
  • Theres a plant nearby that is very exposed
  • Another plant is further away but safer
  • This Terrarium has been running for nearly the
    entire pre-set time limit and your score is quite
    low
  • Heal? Score points? Fight? Run away? Spin around
    and around for the remaining time?
  • Up to you!

20
Interacting With The Environment
  • How do I do all these wonderful things?
  • Environment is only accessible locally i.e. I can
    see (or feel) anything my bug is touching and
    anything in a small-ish arc directly in front of
    me
  • However, information about what Ive seen before
    can be collected and stored for later use

21
Stored Information About The Environment
  • Arguably the most important a list of all the
    goals seen to date
  • Information about their location, the points they
    offer, their fixed and random times are all
    stored and can be accessed at any time
  • Details of how the information is stored and how
    to access it will be discussed in subsequent
    lectures same goes for plants and bug
    information

22
Stored Information continued
  • A list of all plants and their information is
    stored also
  • Information about their location is generally the
    only relevant thing youll use
  • Again, information can be accessed at any time
  • Most likely to use it when your injured and
    looking for a place to heal

23
Stored Information continued
  • Information about bugs is also stored
  • Lots of information is recorded about bugs
  • Health, score, kills, speed, heading, position
    etc
  • When you last saw them (important!)
  • Only have information about bugs youve seen
  • Bugs (unlike goals and plants) are dynamic
  • Probably not going to be in the same place or
    have the same information as the last time you
    saw them
  • As the information gets more and more out of
    date, its likely to become less and less reliable

24
Stored Information continued
  • Aside from information about the goals, plants
    and bugs within the Terrarium, another extremely
    helpful feature is the Map
  • A record of the whole Terrarium, which starts
    blank but is updated as you explore
  • Arranged internally in a natural way that
    corresponds to the actual layout of the Terrarium
  • Can be accessed at any time and for any position
    in the Terrarium

25
More About Mapping
  • Terrarium uses a positional system similar to
    Cartesian co-ordinates
  • GridX and GridY
  • X and Y co-ordinates like a graph
  • Different origin
  • All bugs, plants, goals and rocks have a position
    specified by a GridX and a GridY
  • Different objects have different sizes!

26
Mapping continued
  • The map is arranged identically to the Terrarium
    co-ordinate system
  • The specific details of how to use and access it
    will be covered later
  • Simple 2-dimensional array arrangement
  • Contains information about what is in the square
  • If its an organism (goal, rock etc.) it also
    stores information about the organism

27
Bug Vision Basics
  • As mentioned, bugs can see and feel objects
    that are either touching them or are within a
    120 arc directly in front of them
  • Arc extends for just under two bug lengths
    (roughly 8(?) GridSquares)
  • Information about goals, bugs etc. is
    automatically updated every turn
  • But only information about things you can
    currently see are updated!
  • Beware of out-of-date information

28
Vision And Exploration
  • New feature for this year
  • Have I seen this square?
  • Map holds a boolean (true or false) variable for
    every square in the Terrarium that is true if
    your bug has seen the square, and false if it
    hasnt seen the square
  • Handy for exploration
  • How to use it is again left to you

29
Moving Around a Terrarium
  • Moving can occur in one of two ways
  • Move to a position in a straight line
  • Position can be specified exactly, or can be
    supplied by saying move to this goal, or move
    to this plant etc.
  • Find a path and move along it
  • Obstacles almost always disrupt movement in a
    straight line
  • Automatic path-finding and following code

30
Path-Finding continued
  • Based on the A Algorithm
  • Specifics on path-finding and the methods used
    within Terrarium will again be covered later
  • Fairly efficient method of path-finding
  • Really shouldnt call it many times within a
    single DoAction()
  • Fairly relaxed time-limit on thinking (but one
    exists nonetheless)

31
Path-Finding continued
  • As youll see the path-following code is not
    perfect!
  • Works well enough to allow you to plan and make
    journeys over long distances
  • Breaks journey down into smaller, straight line
    segments automatically
  • Dont worry about understanding how path-finding
    works at this stage

32
Enough On The Basics!
  • That concludes the basics of Terrarium
  • Almost certainly left something out though!
  • Dont worry, any omissions or confusing points
    will be explained in later lectures!
  • Any questions at this point?

33
Basic Strategies
  • Ideas to use in Terrarium can come from a huge
    variety of places
  • Articles online (and on the module page)
  • Journals and books from the library
  • AI techniques and approaches
  • Nature what real bugs do
  • Web-sites
  • From nowhere! (Original ideas)

34
Strategy
  • As well as short term plans (heal when Im hurt,
    attack a weak and nearby bug) you will probably
    also want to have a long term strategy
  • Explore everywhere
  • Kill everyone
  • Hide for a long time till everyone is dead
  • Etc

35
Strategy continued
  • Rewarded for original, interesting and unique
    ideas
  • Like Virus, it helps a lot if they actually work!
  • The point of the game is to score the most points
  • The point of the coursework is to be creative in
    the way you try to score points!
Write a Comment
User Comments (0)
About PowerShow.com