Sign in to follow this  
KaanAlpar

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

Recommended Posts

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. 

 

 

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this