Jump to content
  • Advertisement

OpenGL Tower Defense Indie Game Dev Blog #1: 3D Models and Pathfinding

EddieK

1272 views

About the Game

As you probably have guessed from the title, the game I'm working on is a Tower Defense type of game. At this point I'm still not sure what theme it's going to be in, but I think I will go with military based theme. The game itself is inspired by Red Alert, Robo Defense and Kingdom Rush. For development side of things I'm using Java/Kotlin (mostly Kotlin) + OpenGL and LWJGL with the IntellJ IDEA editor.

3D Models

In the last couple of weeks I've been learning how to make 3D models using Blender. After few days of modelling I got hang of the basics and could model few simple trees, turrets and a car which I then imported into the game "engine".  Here are few screenshots of the models that I have created during those days:

turret

turretScreenshot from 2018-05-14 19-58-12

car.png

 

Pathfinding

I have programmed a pathfinding management system, which uses flood-fill pathfinding algorithm to calculate where the enemies have to go. The way it works is pretty simple. You start by splitting your game map into square nodes and then generating a gradient map which will tell how far away the current node is from the target node. To do this, you firstly start at the target node, assign its value to 0, then for all the neighboring nodes increment their value by 1, or whatever number you want, as long as its a positive number. If the neighboring node is non-collidable, assign its value to something very large, like 999999.

To get the path from the start node to the current node you start at the start node, and select its neighboring node with the lowest value. Then for that selected node, do the same process until you reach node with the value of 0, which will mean that you have reached your target node.

This is how the gradient map looks in my game:

pathfinding1.png

 

Here you can see the numbers at the center of each node which represent its value. The cars are moving towards the surrounding nodes which have the lowest values until they reach 0, that's when they stop.

Okey, so why did I use this method instead of the famous A* algorithm? First of all. This is heck of a lot faster. Instead of always calculating a path each frame for each entity. You just generate the gradient map once, and update it every time an object is placed on the map. The drawback of this method is that all the entities can only go to a single target destination. If you want multiple target destinations, you will have to recalculate the gradient map with different target nodes.

Gameplay

There's not much of a gameplay at this stage of development. As of now all you can do is place turrets, watch them shoot the enemies and that's pretty much it. Nonetheless this is the gameplay footage:

 

 

Twitter: https://twitter.com/extrabitgames
Facebook: https://www.facebook.com/extrabitgames
Website: http://extrabitgames.com

My website: http://extrabitgames.com



12 Comments


Recommended Comments

This is looking very good already! You can do it as part of the gamedev challenge too, there are several of us making tower defence games at the moment. :)

Share this comment


Link to comment
2 hours ago, lawnjelly said:

This is looking very good already! You can do it as part of the gamedev challenge too, there are several of us making tower defence games at the moment. :)

Thank you!

Oh I didn't know there was a challenge like this. Is there a link in which I could read more about this? 

Share this comment


Link to comment

Is just a bit of fun, but I don't see why you can't put yours as an entry even if you are planning on selling your game after. Rutin, Awoken, Dexter and I are doing games I know of so far. :)

Share this comment


Link to comment
43 minutes ago, lawnjelly said:

Is just a bit of fun, but I don't see why you can't put yours as an entry even if you are planning on selling your game after. Rutin, Awoken, Dexter and I are doing games I know of so far. :)

Oh sounds very cool :) I just don't know if I will be able to finish this game by the time the submission date ends. Though I could try making a minimal viable product and submitting that. And then continue working on the game after submission. Anyways, thanks for letting me know. This community is so friendly :D

Share this comment


Link to comment
1 hour ago, EddieK said:

Oh sounds very cool :) I just don't know if I will be able to finish this game by the time the submission date ends. Though I could try making a minimal viable product and submitting that. And then continue working on the game after submission. Anyways, thanks for letting me know. This community is so friendly :D

If you do meet the minimum requirements for the challenge you can earn yourself the 'Tower Defence Badge'!  

Great job by the way.  Your turning mechanism is very fluid.  I also like the military theme you're going with.

Share this comment


Link to comment
1 hour ago, Awoken said:

If you do meet the minimum requirements for the challenge you can earn yourself the 'Tower Defence Badge'!  

Great job by the way.  Your turning mechanism is very fluid.  I also like the military theme you're going with.

Thanks! I will certainly try to get my game submitted there :)

Share this comment


Link to comment

Awesome TD development bro ^_^y It's nice to know your using KOTLIN... I'm learning the language but on early stage.

Share this comment


Link to comment
37 minutes ago, DexterZ101 said:

Awesome TD development bro ^_^y It's nice to know your using KOTLIN... I'm learning the language but on early stage.

Thanks! I've have been using Java for few years now and then decided to switch to Kotlin like a month ago. And all I can is that it is AWESOME :D Less boilerplate code, operator overloading (especially useful in game dev) and many more things which make programming faster. The only thing that I don't really get is the whole thing about non-nullable objects. I mean I understand how it works, but there are lots of parts in my code where I need to have a null object referance. Anyways, good luck with learning! It is really a great and modern language :)

Share this comment


Link to comment

I really like the art work! :) You should be able to meet the min. requirements easily before the due date. I hope you submit an entry! :) Great work!

Share this comment


Link to comment
16 minutes ago, Rutin said:

I really like the art work!  You should be able to meet the min. requirements easily before the due date. I hope you submit an entry! Great work!

Wow, thanks! Didn't expect to get such a positive feedback :) I will try to submit an entry, so I better go back to work now :D 

Share this comment


Link to comment

I found the pathfinding part very interesting!

By the way, which Red Alert did you take your inspiration from? I'm certainly not a huge fan of Command & Conquer and Red Alert :P

Share this comment


Link to comment
EddieK

Posted (edited)

Just wanted to thank you guys for all the kind feedback, you guys are the best!

40 minutes ago, thecheeselover said:

I found the pathfinding part very interesting!

By the way, which Red Alert did you take your inspiration from? I'm certainly not a huge fan of Command & Conquer and Red Alert :P

Thank you! Although I have played all of the Red Alert installments, I think my inspiration comes from the original Red Alert which I played on my PS1 :D I'm actually thinking of making tesla towers inside my game, just because I loved them in Red Alert so much :D

Edited by EddieK

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By MoreLion
      3D Artists And Unity Programmers For Doom Like Shooter
      Game:ROGUE
      Studio:Rebound Entertainment
      Current Team:3
      Payment:Rev-Share Or Kickstarter
      Programming Requirements:
      - Must Know And Have Experience With Unity And Know C#
      - Must Be Able To Spend 5 To 12 hours a week on the project
      - Must Be Older Than 15
      3D Artist Requirements:
      - Be Able To Model, Animate, Create 3D Monsters And Characters Or Rig (Must Have at least one of these)
      - Must Be Able To Spend 5 To 12 hours a week on the project
      - Must Be Older Than 15
      Project Description:
      You are on the ESL (The Elementary Space Lab). You wake not knowing what has happened, you soon learn that a experimental AI Has gone rogue and created beasts and monsters to kill anything in its path. Now, you know what your mission is.
      If You Are Interested DM Me on discord at thathuman44#4207 or email me at oneriot3@gmail.com
    • By Ericjor
      Hello Gamedev users. I am new to this forum, and though I am quite proficient at understanding the basics of just about any form of science, I do not have the natural skill or patience needed to become a great programmer, so I ask that you be patient, and bear with me.
      So, to get to the point, I have thought up a peripheral that can potentially be used for various PC games. Without giving away too many details to those not interested in contributing, I will give as informative an explanation as possible. In theory, it will be activated in intense danger sequences, such as in a FPS firefight, melee combat and fight scenes in medieval style RPG's, etc. The difficulty is not in designing the device, but in implementing the program that would detect these scenes in-game. The software would be for Windows PCs, and made to work with as many games as possible.
      I have some experience with how modding works, and have considered how it could be used alongside currently released games such as Fallout 4, Battlefield, Call of Duty, Elder Scrolls Skyrim etc. However, I simply do not know enough about programming to determine the viability of integrating features into the software that would allow the danger scenes and combat gameplay of already released games to trigger the software to activate the peripheral. 
      Essentially I am wondering if this would this be something that could be integrated? If so, how could these combat sequences be detected by the software? 
      If you are interested and have something important to contribute, I can promise you a copy of the software and option to purchase the peripheral at cost if you would like. Depending on your motivation, I am open to working together. Even if you are not highly experienced, everyone has to learn somewhere.
      Whether or not you are interested, I would be grateful for all the advice you have to offer. So, any ideas for how something like this could be implemented?
       
    • By Atomic_Slugcat
      Greetings, reader.
      Our company, the 'Node Collective', is looking for more people to help on our current project, "Where Ravens Fly".
      What is "Where Ravens Fly?"
      As a brief description:
      "Where Ravens Fly" is a FPS open-world adventure game in which the player is in control of the protagonist Raden Roche, a soldier determined to overthrow two factions, the Militia and the Federation that would both bring America and its citizens into a dystopian future if either would win.
      More information on the game's lore and story will be revealed if you sign up.
      What is it that we offer?
      For joining our project and help us with completion of the game, we provide:
      Placement in the game's credits, considerably helpful items for your portfolio and references. A copy of the game for all the employees upon completion.* We ensure meetings are well planned as we have members from all over the globe. This ensures the maximum amount of people can attend and minimising annoyance to where everyone is equally annoyed create a comfortable environment. Some of our staff have had professional experiences with modelling, screen writing, programming, etc... Leniency - Since you are not being paid, we're more than happy to let you work at your own pace (Though we still expect you try and make arrangements for meetings our directors plan if possible, as well as work on projects handed to you in a reasonable amount of time provided by your director / executive). *For your contribution, we provide game as a base item. However, depending on how much you have contributed to the game, we may be more than willing to give you extra content (in shape of cosmetics, etc...) as bonus(es) to thank you. Problems or questions revolving around this should be taken to the executive directors for more information.
      What do we need?
      We are currently looking for the following:
      Concept Artists. Programmers (Mainly those adept in using and working with Unreal Engine 4). Screen Play Writers (For scenes and story). Right now, this is really needed! Please contact us about having this position if you are able to do it! PR Representatives. During your time at the Node Collective, we expect good behaviour and standards. We also expect you to follow the guidelines provided by Discord.
      If you are interested in joining the team, contact me or Sakarin on Discord. Our tags are: AtomicTiger#0238, Sakirin is Cool#0850.
       
    • By totosi32
      I know that is a noob question but, between OpenGL 2.0 and OpenGL ES 2.0, which one got better performance to desktop and/or mobile devices?
      I have read in somewhere that the performance opengl is based on code but some games we can compare oepngl version performances, so idk.
      Which one of both use less CPU & GPU/ got better performance?
       
      Thanks
    • By asunaxing
      The hellish heat of summer has finally arrived, as such many babes took this advantage and opened a few bars. Boss, how about we go for a stroll in the city and cool ourselves from the summer's heat through a nice icy drink. Each babe has specifically prepared 10 glasses of Wine for you, boss, as you enjoy those lovely drink the babes themselves have also prepared loads of rewards. Taking your health into consideration, you'll only be able to drink one glass of Wine from each babe!

      During the event Bargirls will appear all over the map. By clicking on “Spy” you will be able to visit the Bargirl for a glass of Wine.

      ★Event Starting Time: 2018/08/10 at 00:00 (City Time)

      Have fun gaming!
      For more information about Mafia City, Please visit its official site : https://mafiah5.yottagames.com/?language=en_EN
      Instant play Mafia City H5 here: https://mafiah5.yottagames.com/play/
      Mafia City Studio
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!