how to think like a programmer

Started by
11 comments, last by Nicholas Kong 11 years ago

I'm going to be making my own game soon without using tutorials and just using what I know. What I'm having trouble coming up with is the logic of the game. Things like upgrading weapons and towers, how to make ai detect when theres something in their way, things like that. Are there any books or tutorials that help with this kind of thinking while making a game?

Hm well there are surely many ways how to plan out a game before starting, but my favorite one is surely the UML. You can use the UML to have a graphical view, of the class and actions in them. Point out of which classes you will need for your game. We use for example the Tower Defence, a very loved game by many. Now what does a Tower Defence need? We surely need a Tower class since there are towers, surely enemies aka the waves that appear, and maybe a upgrade class for some upgrades the towers need. These are just the logical ones for the game you need, now for the needed ones. You need Initialize that handles all the loading of data, a event which handles all input events, loop which handles all the data updates, render which handles all the rendering of anything that shows up on the screen and cleanup that simply cleans up any resources loaded. These needed ones, i got from the sdltutorials on how to make a tictactoe, if you wish to check out here you go: http://www.sdltutorials.com/sdl-tutorial-basics . Now next after you got all does things we use a Sequenzdiagramm. In there you will produce a graphical display on how the programm handles, like how does the application start? Which class will come first and so on. These are pretty much roughly said the main ones who are needed to think like a programmer while aiming for a game.

I do hope i could help you with my ideas and wish you a great day

Yours Truly

Your friendly programmer :)

Advertisement

" Like if you had an inventory, do you use a class?"

So a useful way to start thinking about this is to do what's called verb-noun analysis. Write some short sentences about things in your world. If you have a thing in your world which has a noun for a name, then it should be a class. It'll then have verbs attached to it, and hence they're methods on it. So; "I want to show the user an INVENTORY. I want the user to be able to SORT their INVENTORY. And that gives you a class Inventory with a sort() method.

Eventually you get used to this enough that you can just sort of see the classes without doing the analysis or you can switch to more sophisticated techniques, but it's a good way to get started.

I'm going to be making my own game soon without using tutorials and just using what I know. What I'm having trouble coming up with is the logic of the game. Things like upgrading weapons and towers, how to make ai detect when theres something in their way, things like that. Are there any books or tutorials that help with this kind of thinking while making a game?

You can google search on the "ideas" and problems and solutions people ran into when they implemented a feature. The tutorials are out there- Youtube videos, websites, forums. There is a bunch. If you never made a game before but have background in programming experience, you can search for the ChernoProject on youtube. It is 2d game programming tutorials. No book or one tutorial by someone gets the job done. You most certainly need to search everywhere and put the pieces you need and found together.

How to think like a programmer. Grab a pencil and paper and start designing. A good design on paper is laid out nicely for the human mind to keep track of the pieces of a larger program and features. Design changes but write a small design, figure out what you know and apply. If you do not know just google search. Google is your friend.

If it is a bug in a feature. Read the last paragraph and trace through where the bug lies in the code. Question what, where, when, why and how is it happening. The 4 W's and 1 H does wonders.

Learn to not give up. You only improve if you persevere. Learn to finish a project and say "I am proud I completed what I wanted in the game."

This topic is closed to new replies.

Advertisement