Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

How Do You Plan?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 superman3275   Members   


Posted 03 October 2012 - 06:59 PM

I was thinking. Right now I'm getting into some bigger projects (For me, at least :), and as I said in my other post, I felt that I wasn't structuring my code correct. But right now, I believe I need to have some kind of pre-visualization process. There can't be anymore "Just start programming and go with it" because I have to go between file 1 and file 2 all the time, and eventually it all becomes spaghetti code. So, how do you Plan, or pre-visualize your projects. Do you go through any steps, and if so, what are they? Are there certain things you include in the process because, from experience, they help? Please share how you manage to keep the "Big Picture", as I've heard it said ;)

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!


Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:


or Personal-Message me on here smile.png!

#2 EngineProgrammer   Members   


Posted 03 October 2012 - 07:45 PM

Assume I want to create a game for example 'MotherLoad': http://www.miniclip..../motherload/en/

I write down everything I need. In this case:
- Tileable sprites for the dirt, copper, tin, etc
- sprite of a vehicle
- Bitmaps for buildings
- Bitmaps for menu's when your vehicle comes closes to a building
- Sounds
- Day/Night -> Bitmap of a sun that moves in a circle.

Ok I got kinda the basics. After this I draw on a piece of paper what classes I'll need and link them.
class main; // entry point of the application
class Window; class System; class Graphics; // will be created in the main.cpp
class Bitmap; class Sound; class Text; // stores handles to the images, fonts, etc
class Vehicle; // this will store an object of Bitmap for your vehicle.
class GameState; // will keep a state ( static int m_GameState = STATE_IN_GAME; // or STATE_MENU_MODE; such things.
class Game; // this will create all game objects, sounds, etc. Also checks collisions.
class Level; // contains information how the level looks like
class LevelProp; // props like dirt, copper, etc. Can be a virtual class and support sub-classes.
Linking I do with drawing arrows from class to class.

Still don't have any code.
Now I think "What possible methods can the classes contain?"
I give 1 example:
class Bitmap
	Bitmap(string path); // Loads an image from a file

	Bitmap* GetBitmap();

	void SetAnimationRect(RECT bounds);
	RECT GetAnimationRect();

	void StartAnimation(int from = 0);
	void StopAnimation();
	void PauseAnimation();
	void SetAnimationSpeed(int speed);
	void IncreaseAnimationSpeed(int speedDelta);
	void DecreaseAnimationSpeed(int speedDelta);

	void Render(int posX, int posY); // The position can also be stored and called with a method: SetPosition(int posX, posY);

	HBITMAP m_hBitmap;
	RECT m_Bounds;
	int m_AnimationCounter, m_AnimationSpeed;

Of course this class sucks. Posted Image It was just an example so don't copy that one. Posted Image

And in case you are wondering, why not painting(Photoshop) and typing instead of drawing(on paper) and writing?
Answer: You only need to have a basic idea for your whole game. So don't waste time with with PS or Notebook.. Drawing & Writing goes allot faster.


#3 Álvaro   Members   


Posted 03 October 2012 - 07:57 PM

Software design a tricky process, mostly guided by experience (primarily meaning "avoid ways in which you have screwed up previous designs").

The first thing I try to do is identify what the core of the project is, and thinking about how to attack that. I try to put together a prototype of that part pretty quickly (so in some sense I start programming early on, but in a very focused way). For this first prototype, all non-core parts of the program are either dummy versions or missing completely. This exercise often will result in a much better idea on how to implement the core part of the project, without wasting too much effort in the wrong direction. The rest of the parts will often just fall into place.

If you have a particular project in mind, perhaps we can give you some pointers on how to divide it up in chunks, where we would start, etc.

Edited by alvaro, 03 October 2012 - 07:57 PM.

#4 Telastyn   Members   


Posted 03 October 2012 - 08:14 PM

I get the idea I want in my head. This very often (for anything more than a day's work) requires not being at a computer, stuck doing some mundane task. Driving, shaving, waiting for the dogs to do their business, falling asleep... whatever. A whiteboard sometimes helps, but isn't required. A peer to bounce ideas off of can help and quicken the process, but isn't good right away (and isn't necessary).

It's hard to describe. I get a mental model of the solution and run through scenarios in my head, changing the model where things fail. As different pieces pass more of the scenarios, they become firmer. Once there's a pretty solid mental model, then I can go to a computer and start coding; fleshing out the details and possibly stopping if I run into an unforeseen roadblock. Often times I will segment the problem into the one I want to tackle now and work on that small chunk of work.

As I've gotten more experience (read: made a lot of bad designs) I've realized how much not being at the computer aids this. I've changed the model to use more pre-defined shapes (design patterns) than random blobs. The model is quicker to react to common scenarios (design patterns/previous good designs), and identify traits of those scenarios that guide the trait of the solution. And since the shapes are more pre-defined, I can work with much larger models now that I could as a beginner.

I've realized how much design documents and other formal design hinder my ability to design code, since the audience for the model there is different than 'me, making code'. Once I translate the design into something others can grasp well (and shift into a writing/communicating state of mind), the images pollute my mental model of it and it takes some time to firm it back up.

The process though hasn't really changed in 20 years.

#5 EngineProgrammer   Members   


Posted 03 October 2012 - 08:41 PM

Superman3275, you can see 3 different ways now to get started. This means everyone has his special way of programming, and you need to find your way. Seek out what's the best for you. Posted Image
Downloading open source games / engines, exploring them has been a great help for me. So I suggest you to do the same.
Look how other people have done it. How they structure their classes, how they have written their lines of code, etc.
It's very hard to tell you a structure / design. You need to explore / see it for your own.

Telastyn, I also try to work everything out in my head. But when a week has passed it's hard to remember where I was. Posted Image That's why I'm writing/drawing it all. So if I look at my paper a year later I can still remember what I've done. Posted Image

Alvaro, I used to work the same way as yours. But I disappreciate it.. Coding immediately caused me allot of messy code, which made me create new projects over and over again. And after that I got 10 files with sort of the same code and I need to look in all of them first to know what I was doing. My first year of programming I made Dragonball Z: supersonic warriors. I've count the number of versions I have: 17. With only 1 working completely. But the examination went pretty good with that file Posted Image. After the examination in school I asked the lecturer how he started when he had a game in mind. He said: "I can't tell you that. Every programmer has his own way of thinking so I cannot tell you how to program like me. But I can give you a hint: Storage your information so you can return at it any time.". And so I came with a piece of paper and a pencil. Posted Image


#6 Álvaro   Members   


Posted 03 October 2012 - 09:12 PM

EngineProgrammer: I don't think of my approach as "coding immediately". I first think of a rough division of the problem into parts (this is often not easy, and it takes time), I think of what the interfaces between these parts are going to look like. Then I identify the hardest part(s) and try to code a prototype focusing there. This is very different from the experience you describe with your Dragonball Z project. Of course, I've been programming for 30 years, so I have a much better chance at making a successful prototype on the first or second attempt than anyone in their first year of programming.

#7 EngineProgrammer   Members   


Posted 03 October 2012 - 09:28 PM

Thank you for the fast response Alvaro. Posted Image
You are programming for 30 years now, that's nice! I have 2 years of experience now hehe.

It would be awesome if you could help me out. You have more experience and you could help me allot now.
I know I'm not the OP but, I want to rewrite this game for another school project: http://www.rocksolid...games/robokill/
How would you handle it? Please play the first level and explore how you would create a game like that. I owe you one. Posted Image

( moderators this is not offtopic. I'm asking a plan to Alvaro. Posted Image )


#8 EddieV223   Members   


Posted 03 October 2012 - 11:11 PM

Two things really help me,

First: get several white boards and lots of different colored markers start drawing your system structure.

Second: UML diagrams, there are some really nice open source UML designers out there. Use them.

Also, when I code, I start by writing the basic classes that passed around as data like a Vector, Matrix, String, Actor, Node, ect... after I get those done then I cleared out most of the small details and can focus on the larger "Manager" kind of classes, which use these data classes that are mostly done.

If this post or signature was helpful and/or constructive please give rep.


// C++ Video tutorials



// Easy to learn 2D Game Library c++

SFML2.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/


// Excellent 2d physics library Box2D



// SFML 2 book



#9 Álvaro   Members   


Posted 03 October 2012 - 11:13 PM

That looks like a very polished game, and it probably took the authors some serious effort to put together. Notice that this is not only a programming project. You'll need graphics, music, sound effects, level design...

I've never made a flash game before, so the first things I would do are getting familiar with the programming environment and testing that I can correctly process input, animate a character, play music, play sound effects... If any of these things is trickier than it seems, better to find out early.

For a prototype, I would focus on getting the gameplay working, even if I don't have a way to load a map, sound of fancy graphics. Programmer art works to begin with.

I haven't given it nearly enough thought, but one possible division of this in blocks would be:
* Description of the scene (as a data structure in memory).
* Scene update
* AI
* Rendering
* Input
* Sound

So you need to write a game loop and work primarily on my first two bullet points (how you describe the scene in memory and how it gets updated). Of course you'll need to render it and you'll need to process input, but input is probably simple and rendering can be kept crude (think triangles instead of robots) for the first stages.

Just make sure you keep things flexible enough that it won't be impossible to add cutscenes and menus in the future. I imagine in this case it would be easier to not use the game loop at all for those things, and simply implement cutscenes and menus separately, with the game loop only running for the game proper.

I don't know if this level of detail helps you at all or not. The next thing is getting dirty and trying to describe the scene in a data structure. A whiteboard and colored markers can be very helpful.

Edited by alvaro, 03 October 2012 - 11:17 PM.

#10 Goran Milovanovic   Members   


Posted 04 October 2012 - 02:51 AM

I ask myself questions:

What are my primary goals?
What kind of system would best serve those goals?

Then I write the simplest possible version of that system, and build from there.

It's simple, but it works for me.


| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |

#11 demonkoryu   Members   


Posted 04 October 2012 - 06:18 AM

The problem with planning ahead is that only experience can give enough information to plan a software design properly. So, in a domain where you have good experience (i.e. many completed programs), you might plan ahead and be mostly right.

Myself, I find that minimal planning and then refactoring as I progress gives me the best results. Refactoring is especially valuable in retrospective to crystallize the real meaning of your code; in contrast to the mess that code can be when you just got it running for the first time. ;)

Edited by demonkoryu, 04 October 2012 - 06:21 AM.

#12 Bacterius   Members   


Posted 04 October 2012 - 07:14 AM

The problem with planning ahead is that only experience can give enough information to plan a software design properly. So, in a domain where you have good experience (i.e. many completed programs), you might plan ahead and be mostly right.

Agree. When I'm not familiar with what I'm implementing, I tend to plan a bit too much and end up repeatedly going "wait, I need this too" and "hang on, this isn't actually what I want" or "oops, I overlooked such and such dependency and now need to redesign everything", which wastes a lot of time.

In my experience, you want to start small (don't start making plans for every little feature you add, or you'll get overwhelmed and will just give up). Plan the core, then add the rest later on when everything works. Make heavy use of stubs if that's your thing. Always try and keep your code as modular and self-contained as possible, so that adding another feature does not interact (and hence, cannot break) other features on the same level of abstraction. Most of your code should be reusable, ideally you should be able to plug in and out features, if that makes sense for your project.

For instance, your game might end up looking like a tree graph, with each node being either a "feature" (for leaves) or a "manager" (for nodes). The tree is strictly going down, so leaves do not interact with anything except utility functions, and nodes only interact with the leaves they use (like the graphics loading manager might use the PNG loader feature to be PNG-enabled or something - dumb example though). This is all very simplified of course, in the real world relationships are much more complicated...

Edited by Bacterius, 04 October 2012 - 07:15 AM.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

#13 Telastyn   Members   


Posted 04 October 2012 - 07:42 AM

But when a week has passed it's hard to remember where I was.

If a class-level plan takes more than a week to do then your problem is too big. Break it down more and work on one piece at a time.

#14 Heath   Members   


Posted 05 October 2012 - 12:59 AM

I start with an idea that I like. I hack together what is basically a starting point, and then this process is triggered in my brain. I read it over and over and over. I tinker with it; I adjust it here and there. Out of that, I can simplify the code and cut away the chaff. I can refactor it. The writer in me can take the helm, and he doesn't like ugly hacks or special cases very much. I rewrite some parts. I combine some things, and remove others. What is left, then, can be more thoroughly documented and expanded to actually do what I want.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.