Skip to content

likexx/riftwarrior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rift Warrior (iOS)

Rift Warrior
The source code for iOS game "Rift Warrior" (Yes, I'm the developer and product owner)
The original game can be downloaded from the link: Rift Warrior at AppStore.

Preview GamePlay Video on Youtube GamePlay Video

Preview Game Introduction Video on Tudou(For China) GamePlay Video

All account specific logic&data have been removed, such as In-App-Purchase, Google Ads, Social Network Sharing, and Flurry tracking. All others remain the same.

Build and Run in Xcode

Use the latest Xcode (tested with Xcode 9) and open: code/projects/riftwarrior/proj.ios/riftwarrior.xcodeproj

Necessary Tools

  • The game map was created/modified using Tiled Map Editor -- I'm not sure if the latest tiled map editor is supported by cocos2d-x 2.2.6. If not, try find the editor released in 2014
  • The opening scene anaimation was done by Cocos Builder link
  • The original game data (configurations) was encrypted using sqlcipher. Now it's just a simple sqlite db located at code/projects/riftwarrior/Resources/db/game.db

Code Structure

Game entry point: AppDelegate.cpp -> startGame()

GameScene: Base Layer containing MainUI, WorldMap and GameStage.
GameStage: Kind of a "ShowStage" to place map, tower(building), and actors(enemy/player). This is similar to the "stage" concept in Flash game.
StageMap: Handling all map related data

Component Based Design

One the core issues in tower defense (or RTS) game design is how to construct code to handle different attacking weapons with various attack styles. The answer is to use component based pattern.

Taking "Building.h" for example. Building is kind of a container which contains different weapon. In the code, each "building" contains a "AttackComponent", and we inherit "AttackComponent" to implement different concrete attack weapons. The building itself doesn't care how the weapon attacks.
Same applies for Player.h

In our later game "Rise of the Orcs", we further moved to have MoveComponent, AttackComponent and AIComponent to implement more complicated logic in various aspects. For this tower defense game, it's roughly good enough to handle.

About

Open source tower defense game with real production level design

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published