1 / 35

An Introduction To Terrarium

An Introduction To Terrarium. An Ex-Student’s Perspective. 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

leora
Download Presentation

An Introduction To Terrarium

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction To Terrarium An Ex-Student’s 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

  4. Virus vs. Terrarium continued… • Those who found Virus’ evaluation function based approach confusing or counter-intuitive may find Terrarium’s rule based approach easier to use • If two Virus players didn’t use random numbers at all they would always play the same game – deterministic • If two Terrarium players don’t 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. What’s 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. 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

  7. 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…

  8. 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 bug’s 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.

  9. Ticks And DoAction() continued… • Within your DoAction() function you must write code that looks at what’s 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

  10. What’s 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 aren’t going to just roll over and die!

  11. 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

  12. 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

  13. 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

  14. Staying Alive continued… • If victorious in combat you’re 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 (I’m still not sure!)

  15. Staying Alive continued… • Plants are static • If you saw it once, it’ll 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

  16. 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…

  17. 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 you’re close enough to eat it • If so, start eating it!

  18. Ticks And DoAction() Again • More complicated example: • Your bug is moderately damaged and there are no bugs in the immediate area • There’s 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!

  19. 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 I’ve seen before can be collected and stored for later use

  20. 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

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

  22. 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 you’ve 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, it’s likely to become less and less reliable

  23. 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

  24. 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!

  25. 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 it’s an organism (goal, rock etc.) it also stores information about the organism

  26. 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

  27. 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 hasn’t seen the square • Handy for exploration • How to use it is again left to you

  28. 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

  29. 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 shouldn’t call it many times within a single DoAction() • Fairly relaxed time-limit on thinking (but one exists nonetheless)

  30. Path-Finding continued… • As you’ll 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 • Don’t worry about understanding how path-finding works at this stage

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

  32. 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)

  33. Strategy • As well as short term plans (heal when I’m 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…

  34. 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!

More Related