Powered by OpenAIRE graph
Found an issue? Give us feedback
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/ ZENODOarrow_drop_down
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/
ZENODO
Software . 2014
License: CC BY
Data sources: Datacite
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/
ZENODO
Software . 2014
License: CC BY
Data sources: ZENODO
image/svg+xml art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos Open Access logo, converted into svg, designed by PLoS. This version with transparent background. http://commons.wikimedia.org/wiki/File:Open_Access_logo_PLoS_white.svg art designer at PLoS, modified by Wikipedia users Nina, Beao, JakobVoss, and AnonMoos http://www.plos.org/
ZENODO
Software . 2014
License: CC BY
Data sources: Datacite
versions View all 2 versions
addClaim

TowerDefense (Unity StarterKit)

Authors: Garcia-Moreno, Francisco M.;

TowerDefense (Unity StarterKit)

Abstract

TowerDefense (Unity StarterKit) A scalable Tower Defense game framework made with Unity3D in C# with a basic AI avoids turrets. That is like a starter kit for creating your own Tower Defense game. All the code is commented to understand how it works and is well structured in order to be readable. Game Scene The Game scene is called "Demo" and it is localed in “Scenes” folder. Controls W, A, S, D: move camera. Right Mouse: rotate camera. Scroll Mouse: zoom camera. ESC: reset view. Screenshots See Screenshot of main view Grid Generation There are too many ways to implement this. We decided to do it by instantiating prefabs that represent each cell with a "Quad" component attached. We chose this because it is simple and does not require a higher performance. However, the best way could be to apply the voxel technique, but it takes a very more time to implement and for our purpose the chosen form is valid. We have registered all instantiated cells in an array to access whenever I want to do something with them. GridGenerator We apply singleton pattern to having a unique instance of this manager. In the demo scene we find “GridGenerator” game object handles this process. We can modify in the inspector some attributes I present in the following table: Attribute Description Width This is the width of the grid. Height This is the height of the grid. Cells Pbs This is an array with all of the different cells we have (prefabs). Enemies Spawner Coords This is an array with all of the cells coordinates when we want to enemy forces spawn. Crystals Coords This is an array with all of the cells coordinates when we want to there are crystals. We have a personalized exception (“RepeatedCoordsException”) to control enemy and crystal cells whose coordinates are not equal. Cells Every tile prefab has two materials, one for render a grid around it and other one for the own color of cell. We have four types of cells: Normal: a basic cell where we can put turrets. Bound: represents a bound of the grid and we cannot put any turret on this. Enemy: where enemies are spawned. Crystal: where crystals are located. We can see the class hierarchy in the following UML diagram: See UML Diagram We have considered a cell like a node that has two coordinates to locate it easily in the grid array of GridGenerator. Also, we can know if it is walkable, that is, an enemy can walk through it. This is useful for the Pathfinding implemented, the same way it is important to know neighbors nodes so we have an array with them. We use delegates and events in Cell class to notify when we put a turret because enemies need to recalculate their path to continue moving and skip this cell. We use delegates in Crystal Cell to notify enemies when a crystal cell has no more crystals and they recalculate their path again choosing a new target crystal cell. Turrets This is the turrets class hierarchy A Turret game object has a sphere collider component that is fired when an enemy collides with it, then it is added to the turret’s target. Enemies that are in range are put in a target’s pool sorted by natural order criterion of Enemy class. Also, turrets has a price to buy them. Shot method is called in the Unity’s Update every frame. To control that each type of turret shot with an specific rate it has “shotRate” parameter. In Laser Turret case, this attribute is set to zero to apply damage to target enemy in every frame. Cannon Turret shots bullets with a specific delay that if they impact to the target, then they apply the damage and, if not, bullets are destroyed when are out of the turret’s range. Units We present class diagram of units handling Enemy class implements “CompareTo” method from System.IComparable to establish the natural order criterion for an enemy, that is, which enemy is closer to catch its crystal. This is useful when a turret add target’s enemies to its pool attribute, because it sorts its list with this criterion to shot the nearest enemy that gets its crystal. Waves We have implemented a Waves system to spawn units Pathfinding with BFS Algorithm We have used BFS algorithm pseudo code to implement pathfinding. I register every previous non-visited node to go from it to its neighbour, so when finish BFS in target node, I have to retrieve them inverted. At the finish, I revert the final path to be prepared in the correct order just to enemy starts moving.

Related Organizations
Keywords

tower defense, unity3d, unity starter kit, tower defense game

  • BIP!
    Impact byBIP!
    selected citations
    These citations are derived from selected sources.
    This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    0
    popularity
    This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
    Average
    influence
    This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    Average
    impulse
    This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
    Average
    OpenAIRE UsageCounts
    Usage byUsageCounts
    visibility views 5K
    download downloads 2K
  • 5K
    views
    2K
    downloads
    Powered byOpenAIRE UsageCounts
Powered by OpenAIRE graph
Found an issue? Give us feedback
visibility
download
selected citations
These citations are derived from selected sources.
This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Citations provided by BIP!
popularity
This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
BIP!Popularity provided by BIP!
influence
This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Influence provided by BIP!
impulse
This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
BIP!Impulse provided by BIP!
views
OpenAIRE UsageCountsViews provided by UsageCounts
downloads
OpenAIRE UsageCountsDownloads provided by UsageCounts
0
Average
Average
Average
5K
2K