Results 1 to 12 of 12
  1. #1
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141

    Orthographic 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.
    Last edited by dtrip; 21-Apr-17 at 00:59.



  2. #2
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141

    tank.01.blend

    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.

    tanks.01.png

    tank.01.blend



  3. #3
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141

    tank.07.blend

    ...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

    tanx.jpg


    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.



  4. #4
    Member rubeki's Avatar
    Join Date
    Jan 2016
    Location
    Toronto Ontario
    Posts
    51
    Looks cool!

    Any plan for multiplayer?
    ---
    Check out Hover Tank Battle League! https://rubeki.itch.io/hover-tank-battle-league
    Twitter: @_rubeki
    Youtube: https://www.youtube.com/channel/UCbF...yn_4XuRENwjsIg



  5. #5
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141
    Thanks,
    unfortunately I have no idea how to make it multiplayer. But it would be cool indeed



  6. #6
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141

    tank.08.blend

    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

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

    tank.08.jpg

    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)
    Last edited by dtrip; 27-Feb-17 at 14:50.



  7. #7
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141

    Standalone playable blend file. Please test the 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.


    tank.13.jpg


    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 =

    5. 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 =

    6. 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
    Attached Files Attached Files
    Last edited by dtrip; 09-Mar-17 at 16:18.



  8. #8
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141
    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.

    Screenshot from 2017-04-21 09-07-53.jpg

    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!
    Attached Files Attached Files
    Last edited by dtrip; 21-Apr-17 at 01:30.



  9. #9
    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.



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



  11. #11
    Member
    Join Date
    Nov 2009
    Location
    Greece
    Posts
    141
    Originally Posted by Lostscience View Post
    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.
    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.



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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •