Advertisement

[C++] How to start building a simple game

Started by August 24, 2016 11:11 AM
2 comments, last by KaanAlpar 8 years, 6 months ago

Hello, I am learning SDL and I am planing to make my first game. I am planing on making a Tic Tac Toe game. I made it on the command line once by myself. But when I tried to make it with graphics I realizied that its much harder. Because when you start building things wrong it gets too complicated too quick.

How should I start building? What should I do first? Should I create a GameManager class? Should I create a class for the X and another class for the O? Or do I make them in one class?

I am just asking for some guidence on how to approach this.

Hi!

Why do you think having separate classes for X and O is good idea? Keep it simple that's what I can say. 2D array of integers(enum? - NOT_SET, CROSS, CIRCLE) for play-area should work fine - then just render it on some change (as long as you don't have some visual effects which needs to be displayed more frequently).

Advertisement

These are the kind of doubts that are signals for an overengeneering mind/approach (a very common disease, you're not alone!).

Why struggle on think about a GameManager thing when you don't even know how to start? Manager of what?

What about coding it in a procedural way, so C++ without classes? If you throw away all the OOP (which seems an obstacle for you at this time), maybe you can focus on the actual game mechanics.

So start as RootKiller said. Think of a structure for your data (2d array with enums) and write the routines to init SDL, draw the playfield with the hardcoded values in, and quit SDL.

At that point you actually started something.

Thanks guys and yes I was over thinking this :P I will start building it.

This topic is closed to new replies.

Advertisement