How to Plan? What to code first?

Started by
14 comments, last by markr 12 years, 6 months ago
Hi, I'm quite sure this question has been asked before, But I have searched for the last 30 minutes and cannot find anything that answers it.

I want to make a 2D platformer. I am going to use XNA and C#. I am not a new programmer, mainly new to "good" game design.

My questions are this:
How do you create a game, and not get bogged down in the Object Oriented design?
Where do people normally start? What is the best thing to code first?
Should I first get sprites drawn on screen and get them move?
Should I first create a good program flow, which will run the different states before anything else?

When creating classes, When should I stop trying to make it better? I always end up thinking there is a better way to do things, and hence spend hours on 1 class.

I will probably have other questions, but can somebody please attempt to answer these questions?
Advertisement
Hi,

Good design is essential to good programming. If you spend some serious time and thought designing your program then all these questions will be irrelevant.
However, if you are not at the level of expertise where you can design things before doing them and you still have a lot to learn about program structure, or you just want to get stuck in and learn as you go along (which I personally highly recommend, as doing is the best way of learning and you have to learn from mistakes as you make them) then I would go with your option of[color="#1c2837"] "get sprites drawn on screen and make them move."
[color="#1c2837"]

[color="#1c2837"]Good luck.

"To know the road ahead, ask those coming back."

1. First start small and write some working code. Try to develop a 'prototype' of what you want to achieve or at least write a rough equivalent.
2. As for graphics, I think start with level design. Figure out what you levels will look like. And how you will represent your levels - data wise. This is crucial in platform games as they are level based. Try to figure out whether you want simple scrolling or continuous scrolling. Then move to tiles and graphics. Typically levels are made of background and foreground tiles. Think of this aspect.
3. Character design and animation. Create your character or use an existing sprite sheet to chalk out your character animations. This is a creative process and will take long, but of course you can use pre-made graphics to quicken the process.
4. Draw your character on the level. Make your character interact in the level - at this stage you should write code for implementing all the attributes of your character and levels: movement, jumping, falling, walls, obstacles, gravity, and so on.
5. Design your challenges and monsters. Write collision detection code for traps and obstacles in level.
6. Design your monsters. You can even make them "intelligent" and detect your character on screen and attack him. This is usually the trickiest part, but you could make do with writing very "AI" code for monsters (e.g. make them just walk up and down a predefined path and hurt the hero/heroine when he/she hits the monster).
7. Now work on in-game displays, lives, bonuses, artifacts and other goodies the hero must collect in-level. Scoring and so on.
8. Main menu, game saving/loading (if you want) etc. Saving and loading will involve saving the data that represents the current game state.

Hope this is useful to you.

Hi,

Good design is essential to good programming. If you spend some serious time and thought designing your program then all these questions will be irrelevant.
However, if you are not at the level of expertise where you can design things before doing them and you still have a lot to learn about program structure, or you just want to get stuck in and learn as you go along (which I personally highly recommend, as doing is the best way of learning and you have to learn from mistakes as you make them) then I would go with your option of[color="#1c2837"] "get sprites drawn on screen and make them move."

[color="#1c2837"]Good luck.


I guess figuring out where to start in the design is my main problem lol.

1. First start small and write some working code. Try to develop a 'prototype' of what you want to achieve or at least write a rough equivalent.
2. As for graphics, I think start with level design. Figure out what you levels will look like. And how you will represent your levels - data wise. This is crucial in platform games as they are level based. Try to figure out whether you want simple scrolling or continuous scrolling. Then move to tiles and graphics. Typically levels are made of background and foreground tiles. Think of this aspect.
3. Character design and animation. Create your character or use an existing sprite sheet to chalk out your character animations. This is a creative process and will take long, but of course you can use pre-made graphics to quicken the process.
4. Draw your character on the level. Make your character interact in the level - at this stage you should write code for implementing all the attributes of your character and levels: movement, jumping, falling, walls, obstacles, gravity, and so on.
5. Design your challenges and monsters. Write collision detection code for traps and obstacles in level.
6. Design your monsters. You can even make them "intelligent" and detect your character on screen and attack him. This is usually the trickiest part, but you could make do with writing very "AI" code for monsters (e.g. make them just walk up and down a predefined path and hurt the hero/heroine when he/she hits the monster).
7. Now work on in-game displays, lives, bonuses, artifacts and other goodies the hero must collect in-level. Scoring and so on.
8. Main menu, game saving/loading (if you want) etc. Saving and loading will involve saving the data that represents the current game state.

Hope this is useful to you.


It is useful, but I guess I am just worried that if I create my game in a certain order, I may end up with critical implementations left out until the end, meaning a refactoring of a lot of code.


It is useful, but I guess I am just worried that if I create my game in a certain order, I may end up with critical implementations left out until the end, meaning a refactoring of a lot of code.


u can not avoid that.. :-) especially not as a newb.. A game is very complex and mostly u just forget about things. If you are new in Game Programming than just start. And don't be afraid of making mistakes.. u will make them.. no matter how good ur planning is

I open sourced my C++/iOS OpenGL 2D RPG engine :-)



See my blog: (Tutorials and GameDev)


[size=2]http://howtomakeitin....wordpress.com/

Still, is there no basic design that people build around?
there are different approaches

u can write the renderer first and than the game logic.. both as different frameworks and then mix them up

or u write everything at one program..

in general u begin with implementing the basic graphics.. so make sure that u can load sprite sets, display them, move them, make them collide. than u will want to implement controls.. of course only basic but that u will have a function in the end which can be easy modified to your needs.. when this is finished and working u take the next step... means, u load levels from a external file (u may need to write a level editor before that)... when this works fine than u can write the interaction of the player with the level.. its a step by step process and u have to begin by the lowest levels.

My project i am working now is a 2D RPG .. i did no planning and just started off. the first time i encounterd a few problems was when i implemented my own scripting language.. but u always can adjust code until it works.. I learned from the project that planning is quite necessary BUT u can't plan every detail... plans are never working out like they should.. rule #1

I open sourced my C++/iOS OpenGL 2D RPG engine :-)



See my blog: (Tutorials and GameDev)


[size=2]http://howtomakeitin....wordpress.com/

Everything FlyingDutchman said.
Get stuck in, don't think that your game will be the most optimal, extendable piece of software ever made and start programming. A good way to start is to make some sort of object class which has an update function and a position vector. Inside your main game loop call an update function which calls the update function from all objects in your game which will be stored in some sort of list / array. Draw all these objects using their positions.

Add to this as you see fit.

Don't be afraid to scrap everything and start over when you need to do some serious restructuring, this is inevitable.

x

"To know the road ahead, ask those coming back."


Hi, I'm quite sure this question has been asked before, But I have searched for the last 30 minutes and cannot find anything that answers it.

I want to make a 2D platformer. I am going to use XNA and C#. I am not a new programmer, mainly new to "good" game design.

My questions are this:
How do you create a game, and not get bogged down in the Object Oriented design?
Where do people normally start? What is the best thing to code first?
Should I first get sprites drawn on screen and get them move?
Should I first create a good program flow, which will run the different states before anything else?

When creating classes, When should I stop trying to make it better? I always end up thinking there is a better way to do things, and hence spend hours on 1 class.

I will probably have other questions, but can somebody please attempt to answer these questions?


I'm actually in a very similar situation as yourself. I'd keep starting projects, try using OOP and more "advanced" methods of programming, and then scrap the project because I went too far ahead of myself. I've started to get past it as I've progressed in my studies as a programmer, but what I can say is this. You may want to hold off on XNA temporarily, as if you're having trouble understanding how to design applications in general, then having to work on the graphics side of it, handling input logic, drawing, etc., is just adding a lot more complexity and frustration to you. I was trying to work on a 2D game myself, and quit every project I started because I was confusing myself when I started realizing how important designing my classes before implementing them was. I didn't even use Lists because I didn't fully understand them, so I went back and worked on a text-RPG.

I can offer this advice: when you're learning how to design games so that you know how all of your classes interact with each other, simply type on the computer (using Notepad) or write in a notebook what you think you will need in each class. For example -

My Player class will need fields to store their health, mana, strength, toughness, intelligence, wisdom, agility, and gold.
My Player class will need properties to modify their health, mana, strength, toughness, intelligence, wisdom, agility, and gold.
My Player class will need functions to display their inventory, start combat, add items to their inventory.

And this could increase/decrease depending on the complexity of your game. When you look at the Player class functions, you notice how there's a function that displays the Player's inventory. Assuming that you create a new class that handles the Inventory, you could create a "has-a" relationship between the Player and Inventory to do this. When you have a simple design laid out before you, the design of your classes seems much less daunting. I wouldn't worry too much on designing the story, the characters, etc., just have a basic foundation for your game so that you don't overburden yourself with all these different classes, interfaces, files, and such. I hope this post provided some insight on getting you started with design.

This topic is closed to new replies.

Advertisement