Ninja is a 3D rpg game that is coded using Visual C++ and modified Andre's Direct X 3D Software Engine. The Coding style is a mix between C(90%) and C++(10%) = C+.

The game is about a Ninja searching the missing scrolls (as told by his master in the intro cut scene).
Main Menu
Ninja's Thunder Strike LV1 (Thunder Scroll Ninja Tech)

Flash Bomb LV2
The Skeleton is attacking
Pathai Village
Pathai Village : Weapon Shop
Earth slam magic
Earth slam magic
Boss battle 1 : Giant Cobra
Giant Cobra's poison magic
World Map 2 with 16 bit shader
Open the portal
Cobranoid's poison magic
Dead Land statues puzzle
Throwing exploding shuriken
Cave with flying bats and enemies Lightning particle effect
World Map
Using Potion in battle
Intro Cut Scene with moving clouds and snow particles


The battle system is turn based like Final Fantasy 10 (without the Stamina Recovery System and the Sphere Grid System), but unlike Final Fantasies you can dodge in real-time during battle. There are also special attacks, items and magics.

GENERAL ATTRIBUTES (ninja and monsters all have these character attributes):

Attack :

Determines the power of each character attacking power.

Defense :

Determines the defensive power of each character (i.e. how much damage the character can deflect).

Magic :

Determines the magic power of each character.

Magic Defense :

Determines the amount of magic damage the character can deflect.

Dexterity :

Determines how well the characters ability to dodge attacks.

Accuracy :

Determines the accuracy of the attack.

HP :

The amount of total damage the character can receive.

MP :

Determines the number of magics and special attacks that can be performed by the character. Not all special attacks and magics needed MP, these are called special skills which are specific to each character.



Standard Attack :

The ninja can do standard sword slash. The ninja's strength + weapon power are calculated during each attack.

Ninja Tech :

The ninja begin with these two special attacks. New special attacks will be obtained when each scroll is obtained.

To use these skill you have to use it from the Ninja Tech Menu. Each number corresponds to the number keys on the keyboard.

Each of these Tech Skills have their own level, so in order to increase the Tech Skills levels you need to use these Skills often. The animation for each each Skill Level is different (e.g Flash Bomb Level 2 has bigger and longer particle effects than Flash Bomb Level 1).

Ninja Special Attack Moves that can be used in battle  (so far I have coded 2 ):

1. Flash Bomb

Level 1

It attacks all enemies with maximum strength + magic+ 5 hit bonus and it costs 5 MP. Cause Stunned/Stop status effect.

Level 2

It attacks all enemies with maximum strength + magic+ 10 hit bonus and it costs 5 MP. Cause Stunned/Stop status effect.

Level 3

It attacks all enemies with maximum strength + magic+ 15 hit bonus and it costs 5 MP. Cause Stunned/Stop status effect.

2. Shuriken Throw

Level 1

Throws 1 shuriken to target enemy. Accuracy +5, Strength -3. It costs 0 MP, but requires Shurikens. Useful for attacking enemies with high Dexterity (i.e. fast enemies).

Level 2

Throws 1 shuriken to target enemy. Accuracy +7, Strength -2. It costs 0 MP, but requires Shurikens. Useful for attacking enemies with high Dexterity (i.e. fast enemies).

Level 3

Throws 1 shuriken to target enemy. Accuracy +8, Strength -1. It costs 0 MP, but requires Shurikens. Useful for attacking enemies with high Dexterity (i.e. fast enemies).

3. Thunder Strike

Level 1

Powerfull strike using magic and physical attack (thunder element). It cost 7 MP.
Attack target enemy with maximum strength + magic +20 hit bonus + thunder element.

Ninja Abilites  (so far I have coded 2):

Ninja abilities will grow (gain new abilities) as the ninja's level increased.

1. Light Feet

Gives the ability to dodge most attacks in battle and run swiftly. Neglects dexterity ability bonus or penalty in battle, since you control the dodge.

2. Telekinetic

Gives the ability to move/rotate objects at a distance without touching them.

Use Items (so far I have coded 3 items)

The ninja can use items anytime except battle related items. Items is used by pressing the number keys from 1 to 9 when the Item Menu is open. Each number on the Item Menu corresponds to the number keys on the keyboard.

1. Potion

Restore 50 HP.

2. Antidote

Cures Poison.

3. Ether

Restore 50 MP.



Each character has a turn in battle. At the beginning of each turn the ninja and monsters
attack , defense , dexterity  , accuracy will be shuffled base on their max attributes points from 0 to +5 max attributes points.

The shuffling will balance the attributes (e.g. the higher the accuracy the lower the attack and vice versa).


The ninja can dodge most attacks by pressing the dodge button at the right time (during the enemy turn). As long as the dodge indicator in on, the ninja can dodge the incoming attack.

Status effect

Currently there are four status effect :

Stunned / Stop :

The character will lose their turn for a specific amount of time.

Poison :

Reduce the character's HP over time until it reaches 1.

Attack Decreased:

Lowers the character's Strength by 50%.

Defense Increased:

Increases the character's Defense by 50%.


I have coded Item Shop and Weapon Shop functions. When you are close enough to the seller a notice will pop up and if you press P then it will show the related shops menu where you can buy and sell weapons and items.

The ninja can only use 1 type of armor and weapon at a time, so when you buy these your old armor and weapon will be sold automatically. The ninja's apperance will also change base on the armor and weapon the ninja's currently equiping.


In this game defeating monsters will not directly give you gold coins, instead you will collect the defeated monsters body parts and later you can sell them in shops to receive  gold coins. Each monster will have different value.


When the ninja is close to objects that can be moved/examined, etc. There will be a message appear on the middle left of the screen. This method is also used to talk to NPCs, simply press the action button (P) to talk or to examine objects and other actions.

The action button is a multipurpose button.


The standard bounding boxes and spheres are used for collision detection.


So far I have finished coding 2 interactive Locations and 2 cutscene locations.



The Ninja's Master trained here. This location is seen in the intro cutscene.


This Cave is located near the Snowy Mountain area and go all the way down the mountain. The Cave is like a maze, you have to find the way out of the Cave.


This village is located north west of Snowy Mountain. The village has good item and weapon shop.



A very cold land and it can only be entered through a portal. You will have to solve all the puzzles here (ala Zelda's dungeons and FF dungeons).




OTHER PLACES..........


Rendering is done using Direct X with Andre's 3d Software Engine. Since this is a software engine I am doing my best to minimize the amount of polygons that must be rendered to keep the frame rate 50+ and around 30+ fps when there are a lot of polygons. So far I have managed to keep the game stable (running smoothly).


The biggest problem with this engine is when rendering the world map where the ninja travels. So I divided the world map into chunks of world map pieces and only rendered the needed chunks. In other word I used a manual offline (precomputed) PVS (Potentially Visible Sets) to determine which part of the World Map to draw based on the current ninja's coordinates.

The engine supports 3d clipping, but it still just not fast enough for the game, that is why I divided the world map.


Andre's engine is really flexible. That is why I can add this effect. I relized most Playstation games used this effect (Resident Evil, Final Fantasy, etc) to make their games looks good, so I decided to do this as well. I searched many fotographs from the web to be put as a background for my game (e.g The Cave Level and The Ruins Level of my game). To give the impression that it is 3D I added layers of 2D images edited using Photshop so that the 3D polygonal characters can go behind objects of the 2D image (masking).


Particle effect is not fully supported with the engine, it can draw quads with texture (with masking and alpha channel) but without any specific movement support for particles. So I added particle functions where it will move the particles by supplying the function with particle objects and variables.

Added linked particle support for effects. With this I can add or chain effects together with other effects to create another effects without trouble.

Particle effects are done using quads polygon (.cob objects). 


The models used are MD2 models. I downloaded the models from Polycount.


Shadows are done by projecting the objects/models to the ground but with their lighting/texture off (black). Shadows really ate the engine's power (down to 20 fps if you have a lot of shadows) so I have to add a few tricks to simplify the shadows. In the end I managed to have 4 animating 3d models and 4 shadows on screen. 


The engine does not have any support for enemy AI, I added this to the engine with AI functions that receive enemy objects as their parameters.


There is no random battle in the game, you can see the enemy and when you are close enough to the enemy battle will happen.

Some enemies will stay still while others will after you if you are close enough. Detections are done by calculating  the distance between the ninja and the enemy. If it is close enough then the angle will be calculated using triangles (Pythagoras and angles or 3d vectors) and the enemy will turn towards the ninja.

The are also patrolling enemies, but their patrol routes are not complex yet, I will fix this later, after most of the other parts of the game are done.


Enemies can have diffrent or similar or same Battle AI. Some enemies will fire projectiles while their HP are still high and switch to melee attack when their HP are low. Some enemies will only use melee attacks. Some enemies will use attacks that cause status damage (e.g stop effect causes the ninja to stop moving for a certain amount of time).

The Giant Cobra's attacks are all randomized. It will shuffle the three types of attacks that this Boss (Giant Cobra) have.

Other Bosses will have smarter AI it will react based on the Ninja's attacks, HP ,etc.

Currently there are 5 AI functions that can be changed based on their parameters and two Boss AI function.

There are still a lot of things to be done. Currently it is 15.8% completed. I have been busy with my Hero's Quest Game project, so this on will be put on hold until Hero's Quest is finished. 

Author: cmangund
Last Modified: 21 Sept 2004