Claytus Hood Tower Defense case study

I always loved games that revive an old concept with new features, and Claytus Hood Tower Defense is one of them.

Based on the old “tower defense” theme, it introduces new strategy options with large, scrollable maps and the capability to block some paths to make enemies take a larger route to attack you base.

Roux Raphaƫl, the author, shares with us his experience:

« Why did I decide to work on Claytus?

Before that, I used to be a developer for a web agency, coding online shops or institutional communication websites… not that fun!

After I lost my job at the end of 2009, I decided to increase my knowledges in AS3, to code funny stuff like games for example!

I always learnt programming by myself (the geekish way), with books, resources found on the web and personal experience…

I thus decided to read Keith Peters’ book “AS3 animation – Making Things Move” to fill my gaps in maths, and I saw lots of quite useful things to code games I had forgotten.

After reading this book, I managed to learn AI and Pathfinding, I thus studied A* algorithm.

Here are the examples I inspired myself of to learn A* :
http://www.remixtechnology.com/view/AStar-haXe.

Well, I reviewed trigonometry, I know A*, what can I do with it? A Tower Defense game! Let’s code!

Claytus is thus my very first game, and I learnt lots of things about AS3 best practices while developing it.

Here are a few technical informations about Claytus’ realization and technics I used for its design :

– it’s a full AS3 project developed with Flex Builder 3, a great software that allows to gain plenty of time as soon as you master it (spelling, auto import, debugging, profiling, etc.).

– I had to establish a good workflow between Flash for graphic assets and Flex for AS3 coding (do you Flax??). With the Embed tag, I succeeded into compiling the game in a single swf and I didn’t have to load external assets.

– Setting up the AS3 project in FlexBuilder 3 so that the MochiAds works well is really very tricky, with the add of a Preloader class before the Main class and compiler arguments (-frame 2 Main) so that the Main class is added to stage only on the second frame!

– I managed to set up optimization strategies for AS3, thanks to G Skinner tricks and benchmarks. (http://gskinner.com/talks/quick/)

For the first level, the use of A* isn’t so blatant; it’s gonna be much more in the following levels where you can block your enemies’ way.

Today, my challenge is to avoid cheaters on my leader boards :'(

About the TD wannamake

I didn’t use the easiest way to code a TD game, it’s thus quite hard to give you basic tips. Here is a list of a few basics for coding TD :

– The game takes place on a Tilemap, with a Boolean for each tile which holds isWalkable for the A* and isBuildable for the turret build.

– When an Enemy spwans, it asks its path to A* and I put its reference on an Array (enemyArray).

– The turrets go through the enemyArray in search of an enemy on its range and then open fire if their Boolean isReloaded == true.

– To estimate the distances and so check the range, I use Manhattan distance formula, less accurate but faster than Euclidian distance.

– The non-reloaded turrets reload during a few frames to simulate the firerate and then start again to look for a potential target.

Of course the process is far more complex, if you need more information about a precise point, don’t hesitate to ask me!

Easier methods than A* exist to build a TD, if the level has only a single way, no need for A* but to give an information about the direction to take when going out of the tile, such as hard coded waypoints.

Claytus’ graphism

In the beginning, Claytus used to be quite ugly, as a game skeleton with circles for the turrets and triangles for enemies, as for any experimental game skeleton I guess!

I thus offered to friends of mine who are illustrators to work with me on the project, to give life to my circles and triangles ! They were just finishing their studies and I think Claytus has been a good opportunity for them to increase their knowledges in Flash and add a valuable project to their portfolio. They learnt a lot about technical constraints that represents the integration of a drawing into a video game.

All of the Claytus’ artworks were so designed on a graphics tablet coupled to Photoshop. I didn’t wanna use vectorial drawing to economize resources and keep an artistic look. Only using bitmaps, I get very good performances on an old computer on which Bloons TD 4 freezes =D.

Claytus’ music

The music for Claytus TD was exclusively composed by friends of mine! The musicians didn’t know video games field that well, and they brought their point of view and an acoustic soundtrack. I love it!

How to give freshness to an old concept

It’s true it’s difficult to create something new in TD game because lots of things have already been done.

Lots of TD only send lots of waves and lots of enemies with a huge arsenal…

Finally, this gameplay type is much more of a massacre timekiller that you win whatever you do!

I wanted to create a much more challenging game with Claytus TD. I agree it can raise an issue to some of the players, but the fact that is challenging makes others happy!

The game begins with a single way, and only three different turrets, which poses Claytus as a real strategy and positioning game, you have to think every move you make!

In the other levels, we bring each time a novelty in gameplay : stage with other possibilities as multiple ways possible, new turrets and new upgrades in addition to gameplay elements of the stage.

I wanted every turret unique with a precise goal, that’s why you can’t do anything if you wanna win.

About the funding

Claytus wasn’t made to raise money at first thought, it was more of a project to help me learning to code in AS3 and manage a project with high quality standards.

I’m thus just incoming into flash game field and Mochimedia helps broadcasting the game on tenths of the websites of their partners.

Website

Claytus TD have its own website at http://www.claytus-towerdefense.com.

I made it to showcase the game in a nice looking website with drawn background.

The website introduce the team, the French version have a forum (I will add an english forum asap), and people can mail me via the contact form.

I also upload preview pictures of the next levels and the next soundtracks because Claytus TD intend to have six levels and more, but its takes a lot of time to create all of this stuff!

To stay tuned, players can become fan on Facebook and subscribe to my
newsletter.

Level Editor

I have build a level editor to help me making level and learning tool programming, coded in Flex, MXML & AS3, great technology to deploy rich applications (RIA).

It’s not released for the public at this day, but if I have time i’ll code a friendly user version for the people can make their own level and why not create a level contest? »

Get the most popular Phaser 3 book

Through 202 pages, 32 source code examples and an Android Studio project you will learn how to build cross platform HTML5 games and create a complete game along the way.

Get the book

214 GAME PROTOTYPES EXPLAINED WITH SOURCE CODE
// 1+2=3
// 100 rounds
// 10000000
// 2 Cars
// 2048
// A Blocky Christmas
// A Jumping Block
// A Life of Logic
// Angry Birds
// Angry Birds Space
// Artillery
// Astro-PANIC!
// Avoider
// Back to Square One
// Ball Game
// Ball vs Ball
// Ball: Revamped
// Balloon Invasion
// BallPusher
// Ballz
// Bar Balance
// Bejeweled
// Biggification
// Block it
// Blockage
// Bloons
// Boids
// Bombuzal
// Boom Dots
// Bouncing Ball
// Bouncing Ball 2
// Bouncy Light
// BoxHead
// Breakout
// Bricks
// Bubble Chaos
// Bubbles 2
// Card Game
// Castle Ramble
// Chronotron
// Circle Chain
// Circle Path
// Circle Race
// Circular endless runner
// Cirplosion
// CLOCKS - The Game
// Color Hit
// Color Jump
// ColorFill
// Columns
// Concentration
// Crossy Road
// Crush the Castle
// Cube Jump
// CubesOut
// Dash N Blast
// Dashy Panda
// Deflection
// Diamond Digger Saga
// Don't touch the spikes
// Dots
// Down The Mountain
// Drag and Match
// Draw Game
// Drop Wizard
// DROP'd
// Dudeski
// Dungeon Raid
// Educational Game
// Elasticity
// Endless Runner
// Erase Box
// Eskiv
// Farm Heroes Saga
// Filler
// Flappy Bird
// Fling
// Flipping Legend
// Floaty Light
// Fuse Ballz
// GearTaker
// Gem Sweeper
// Globe
// Goat Rider
// Gold Miner
// Grindstone
// GuessNext
// Helicopter
// Hero Emblems
// Hero Slide
// Hexagonal Tiles
// HookPod
// Hop Hop Hop Underwater
// Horizontal Endless Runner
// Hundreds
// Hungry Hero
// Hurry it's Christmas
// InkTd
// Iromeku
// Jet Set Willy
// Jigsaw Game
// Knife Hit
// Knightfall
// Legends of Runeterra
// Lep's World
// Line Rider
// Lumines
// Magick
// MagOrMin
// Mass Attack
// Math Game
// Maze
// Meeblings
// Memdot
// Metro Siberia Underground
// Mike Dangers
// Mikey Hooks
// Nano War
// Nodes
// o:anquan
// One Button Game
// One Tap RPG
// Ononmin
// Pacco
// Perfect Square!
// Perfectionism
// Phyballs
// Pixel Purge
// PixelField
// Planet Revenge
// Plants Vs Zombies
// Platform
// Platform game
// Plus+Plus
// Pocket Snap
// Poker
// Pool
// Pop the Lock
// Pop to Save
// Poux
// Pudi
// Pumpkin Story
// Puppet Bird
// Pyramids of Ra
// qomp
// Quick Switch
// Racing
// Radical
// Rebuild Chile
// Renju
// Rise Above
// Risky Road
// Roguelike
// Roly Poly
// Run Around
// Rush Hour
// SameGame
// SamePhysics
// Save the Totem
// Security
// Serious Scramblers
// Shrink it
// Sling
// Slingy
// Snowflakes
// Sokoban
// Space Checkers
// Space is Key
// Spellfall
// Spinny Gun
// Splitter
// Spring Ninja
// Sproing
// Stabilize!
// Stack
// Stick Hero
// String Avoider
// Stringy
// Sudoku
// Super Mario Bros
// Surfingers
// Survival Horror
// Talesworth Adventure
// Tetris
// The Impossible Line
// The Moops - Combos of Joy
// The Next Arrow
// Threes
// Tic Tac Toe
// Timberman
// Tiny Wings
// Tipsy Tower
// Toony
// Totem Destroyer
// Tower Defense
// Trick Shot
// Tunnelball
// Turn
// Turnellio
// TwinSpin
// vvvvvv
// Warp Shift
// Way of an Idea
// Whack a Creep
// Wheel of Fortune
// Where's my Water
// Wish Upon a Star
// Word Game
// Wordle
// Worms
// Yanga
// Yeah Bunny
// Zhed
// zNumbers