🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Tower Defence Challenge

Published May 04, 2018
Advertisement

Ok so I needed a distraction so I might have a go at this tower defence challenge at Gamedev. I've been meaning to have a play with Unity .. I'm a c++ guy who tends to do *everything* themselves, so this is quite a change using a rapid development environment and *gasp* someone elses engine. That said I'm gonna have some teething issues with trying to learn Unity and C# from scratch at the same time as doing the challenge.

So I followed some tutorials last night on youtube and this morning, and I have a tentative feel for how I might be arranging stuff in this drag and drop editor thingy. I still end up having to google how to do every little thing but I'm sure it will get faster.

TowerHuts.thumb.jpg.f08bb8e8992096e641acfd859b3b1290.jpg

I want to make a global array of map locations to put your towers in, so each location is either ground for walking, a tower of some type or some decoration. Instead of making all the graphics specifically for it, I thought I'd rip off some of the models from my jungle game. I haven't got anything resembling a tower yet, but I'm sure I can build something quick in blender.

The process of importing models from blender seems a bit clunky (I was hoping to be able to import a whole lot at once) but is just about doable, it won't seem to recognise the textures in a blend file so I have to set them up manually.

So I now have it creating a grid of prefabs, it should be easy to import some more prefabs, vary them according to some map generator. Come to think of it I should try playing a tower defence game for research, I don't really know how they work... :)

TowerHuts2.thumb.jpg.810a7ec9f7016ae6358df2564b558c32.jpg

Previous Entry UI Improvements
2 likes 6 comments

Comments

Rutin

You'll catch onto to C# fast coming from C++. :) Looking forward to seeing your progress! Nice work!

May 04, 2018 02:30 PM
Awoken

Right on, I'm excited to see more participates being a participate myself.  

Quote

c++ guy who tends to do *everything* themselves

I hear yeah on this.  I like to try my hands at most if not all as well, or at least have ambitions too.  But what I'm starting to realise is that my particular programming style is unprofessional to say the least.  I don't document and I use really crappy names for variables, I have this need to see all the logic of the code to be displayed within the screens width.  This is going to be problematic because eventually I would like to partner with others.  I'd like to learn how to use more out of the box solutions to problems instead of always relying on my own.  For someone who wants to take his programming more seriously, what observations do you have about the two approaches?  Out of the Box vs Self created, especially in regards to attracting other talent to collaborate with? 

May 04, 2018 06:24 PM
lawnjelly

Well as for code quality, I'm no expert, but once you have something working it is often worth taking some care and extra time to refine what you have written. Refactoring is fantastic, do it once do it twice, it makes it clear in your mind what you are doing and the best way of writing interfaces. If it is something you might use again, make it into a library. I read some good stuff by Randy Gaul the other day on the benefits of making great simple-as-possible interfaces to your code to make it easy to use for yourself and others. Coding standards / style are something that are often enforced at companies, but is useful at home too.

Having said that being a total beginner at C# all my code for this tower defence thing will be a spectacular mess. :)

Working with others .. biggest tip I think is to try and get a clear modular nature to the code, so you are not treading on each others toes. If you do this you can (in theory, and in practice sometimes(!)) even write in completely different styles and still have things work together.

Using third party engines / libraries is something it sounds like we should both probably do more. Obviously you can potentially be a *lot* more productive, as long as you also recognise and accept the limitations. But these days I'm lucky enough to write stuff more for learning and intellectual fun than for any particular end result.

May 04, 2018 07:14 PM
Rutin

@Awoken I'm not sure 100% about all of your struggles, but I'll try to give some advice.

When you're coding don't over complicate your problem. Keep things simple and straight to the point.

Avoid coding the same thing more than once, otherwise make a function that handles that operation. Do not repeat yourself!

Provide short summaries with each function to describe what is going on. Its better to have comments than not.

Properly indent and space out code, it makes things cleaner. Yes you take up more "lines" but who cares, it's more important to make your code readable than cram everything into 1 line.

When dealing with variables and so forth, keep the same style when you name. I personally use this style: orcEnemy, woodenSword, some people use orc_enemy. I also name my stuff so I can look at it once and know what it's supposed to do. For example I have a input queue class for my text box so I will name it as such textInputQueueManager. I also make my sure that my functions are named properly. textInputQueueManager.addTextStringToQueue(string);

 

 

May 04, 2018 07:28 PM
Awoken

Hey thanks you two, I appreciate it.  Looking forward to seeing what we all cook up.

May 06, 2018 04:28 AM
Rutin
Just now, Awoken said:

Hey thanks you two, I appreciate it.  Looking forward to seeing what we all cook up.

No problem. If you ever need help let me know.

May 06, 2018 04:29 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement