Isometric tanks

Hello people,

I started this project to learn Blender Game programming. I have been a programmer since 1991 and Blender user since 2012.
It is my hobby, since now I am a high school teacher and father of two. However, I find great fun in building stuff with Blender.

Following will be posts with the incremental version source code so that you can study and run the game, and also a brief explanation
of how stuff is done. Source code is provided under the GPL license.

Greetings and respect to all the Blender community, I really owe you guys, it is a remarkable place to be here.

This is the first version of the game. What you can do here is

  1. Drive the tank model with the keyboard WASD
  2. Move the turret with UP, DOWN, LEFT, RIGHT
  3. There is also a camCube object that follows the tank around. An orthographic camera will be “child-ed” to the camCube, so that the game takes on an orthographic view.


tank.01.blend (511 KB)

…with textures.

In this version our tank is textured, the tank cannon has limitations and the camera is the child of the (now red) camCube.
See the code of camCube to see how it follows the tank. It has the same location with the tank, minus some units along the x and y axes,
and plus some units along the z axis to go higher. Also, it turns left and down. I experimented a lot with these to put the tank in the center.

There are invisible static walls that do not allow you to fall off the level (very useful !!!).

There are also walls and other obstacles. Those are “static”, while the hero tank is “Character”.
A nice touch of “Character” is that it follows the terrain even if there are mountains. In future versions the ground will not be level, it will have slight “mountains”, etc.

There are also a couple of enemies, a moving enemy (tank) and a stationary enemy (turret).
There is also a red-yellow small bullet somewhere.

But the enemy tank, the turret and the bullet do not do anything. They just sit there.

tank.07.zip (3.21 MB)


Next, I am working on enemy AI, that is I need the tank to move towards our tank and shoot at him in intervals.
The turret will run the same AI, although his movement will be zero.

Looks cool!

Any plan for multiplayer? :slight_smile:

Thanks,
unfortunately I have no idea how to make it multiplayer. But it would be cool indeed :slight_smile:

Features added:

[1] Shadows
[2] Enemies created = The trigger plane now creates one enemy tank and two enemy turrets.
[3] Independed enemy tank/turret movement: The enemy tank body runs a different script than its turret. This will be later very useful because we will be able to combine different tank chassis with different turrets, thus creating a variety of enemies.
[4] All three turrets are now programmed to always aim at the player and Shoot every few seconds if
the distance is closer than 7 units. Shoot itself has not been implemented yet, it is only printed in the console.

What you can learn:

  1. Go to layer 2 and click any of the two towers to see how they track the player (Edit Object actuator —> in Track To mode)
    (you need to have a Logic Editor window open to see the Logic blocks)
  2. Read any of their scripts (TurretSingle1 or TankTurretSingle1), to see how to measure distance from the player tank =
    = (subtract the world Positions).length
  3. Read script TankTurretSingle1, to see how it always gets positioned on the tank (you just copy the worldPosition of the tank, to
    the worldPosition of the turret).
  4. Go to layer 1 and click the Trigger1 plane and read its script (Trigger1). There you can see how to create the enemies and
    how, when it creates the tank and its turret, it creates custom variables on each one to link with each other. The link is
    required when one is shot and killed, to desrroy also the other. This has not been implemented yet, but it will.

New .blend file is here:
tank.08.blend (1.22 MB)

(textures are the same as previous file tank.07.zip . Place tank.08.blend file in the same directory as tank.07.blend file)


Next, I am implementing shooting bullets and collision detection. I still have to decide wether the player will have HP or dies instantly (I prefer the latter mua ha ha ha ! - no seriously, I believe it results in more adrenaline rush gameplay)

Hello, this is an early demonstration of gameplay.

Unzip the game. It is standalone (does not require anything from previous posts)

Open the file, press p to start the game. Make sure folder “tex” is in the same folder with tank.13.blend (it should be, automatically)

Move tank with WASD
Move turret with UP, DOWN, LEFT, RIGHT arrow keys.
Shoot with SPACE

Kill the two turrets and the tank. Your shots are ballistic, while theirs are linear (whats the antonym for ballistic in English ?)
If you kill them or you get killed instead, nothing else will happen. So press ESC and P again to try again.

Please tell me what you think of the gameplay. Is it too hard ? Personally I love it, but I guess it does not matter much what I think.
At the beginning its kind of hard, but after a while you grow to it and it becomes rewarding to hit them successfully.


IF YOU WANT TO STUDY THE CODE, START FROM THESE OBJECTS/SCRIPTS:

  1. Player tank body moves with WASD (logic blocks)
  2. Player turret moves wth LEFT and RIGHT (logic blocks)
  3. Player cannon moves with UP and DOWN (logic blocks)
  4. Player cannon shoots with SPACE (logic block calls script)

How enemies are created =

  1. Enemies are created when player tank steps on the plane named TRIGGER1.
    What that planes does when it collides with “DesertCamo” (this is the material of the player,
    it is unique so he can be easily detected by the game), is call a script which spawns enemies.

How enemies are destroyed =

  1. Explosion and smoke empties are created by “EnemiDie” script. This script is called by
    the enemy tank and turret, when they collide with the player’s bullet material.

So there it is in an nutshell. Any questions feel free to ask.

I hope you like it , greetings, Dimitris

Attachments

tank.13.zip (801 KB)

Finished the first two levels, they are downloadable and playable below (as blend files for now)

The blends will save hiscore.txt file in the same directory you place them.

Level 01 is an instructions tutorial with targets only. Level 02 has enemy cannons that can kill you and a boss
cannon in the end. Now working on Level 03 with moving tanks that can patrol and follow player and use a nav map.

Warning about the code comments = sometimes they refer to other files (because of copy paste). This will be fixed soon.


That’s it for now, I hope you like it!
Please tell me if you like the game and if you think it is too hard or too easy.
Good bye!

Attachments

LEVEL2.01.blend.zip (320 KB)LEVEL1.01.blend.zip (284 KB)

Why don’t you use google drive to make a standalone version of your videogame.Then share the link with us.Because blender artists.org has limit of the megabytes that can be uploaded.
It is what i did.

Looks really great so far.
Keep up the good work.

Yes, I have thought of that,

I am currently at Level 03. The game has 10 levels hopefully. There will be one more upload before the game is finished.
When it is finished I will upload it at some file service and remove all files from blenderartists.org.

I am waiting for the finished game or a blendfile with all the current levels on them.

The turret (player) could aim at the mouse, and the gun could aim ballistically. https://blenderartists.org/forum/showthread.php?410320-Trajectory-Aiming

I like your progress. Thats amazing i wish id progress like that bro !!!

Fred/K.S

Finished at last.

Tips, credits, locking levels and main menu, took me more than I expected. But in the end I believe
it is an interesting game! Took me about 4 months to make, all by myself, starting from almost complete scratch.
Average working hours must have been about 20 hous a week. So total it must have taken 200-300 hours.

Full source code and assets available. I grant you permission to use anything, anyway you like.

I put a lot of effort to make it presentable and playable, so play and have fun !!

Any comments are welcome.

Isometrictanks source code - also includes a brief explanation of the code.

Isometric Tanks for Ubuntu - standalone executable:

Isometric Tanks for Windows-64 - standalone executable:

Note about the source code :
Everything is developed by me and I grant you the permission to fully use it however you want,
without owing me anything. The only thing that is not mine, is the ground texture and some brick
textures which I got from free textures Google search, so I believe they are free, but I can not be sure.

I could use some help with the following =

  1. Make a runtime version for Mac OSX

  2. Make a runtime version for other Linux distributions (or verify that the Ubuntu one works for other Linux)

  3. Make a runtime version for Windows XP

Special thanks go to this forum of course, without which it could not be possible.
Also to BornCG YouTube channel, which helped me make a quick start with Blender game engine.

That is all, I hope my game contributes inspiration and assistance to others. Cheers and stay creative!

Made it to level 3! : D

This is an excellent resource and a fun game to play. Thank you for sharing this with the community, I’m certain it will be useful to a lot of people; beginners and veterans alike.

By the way, I didn’t see this in the Finished Games sub-forum, you should totally post it there! : D

EDIT: Forgot some words. Small edits for clarity.

Thank you for your kind words and for playing the game!

The community has done a lot for me and it was about time I gave something back :slight_smile:

You are right, I should post it in the finish section. I will see to it asap.

Thanks again, take care
Dimitris