Help with the structure of a program: A football manager

Hi

Where I work we use C++ often for ad hoc solutions. We are all quite experienced in finding solutions to all sorts of problems in a short timeline but no one of us can actually write a proper large scale program. By proper I mean a well-thought-out, clearly and efficiently structured program.

I'd like to change this, so at home, where I have more time at hand, I'd like to program something which is well structured. I now would like to program a football manager, i.e. a game, where you can steer a football team and play against other computer teams, actually you don't play you just see the result of the game on the screen which was somehow calculated from your players, tactics and so on...

The first version of the game should be fairly simple, I intend to have a user class, a team class and a player class. The user has a team, the team has a vector of players. What I don't know is how to implement the whole playing schedule. Does anyone have a good idea for this?

Also, how to I properly initialize the whole thing? I mean in the beginning I'd like to initialize maybe 200 players and 10 teams. Do I just call the corresponding constructors or what is the proper way of doing this?

I hope my questions are clear enough. Feedback is much appreciated.

Edit: Oh, by the way, if someone can point me to a medium sized example with multiple classes, that would help me a lot! On the web I can only find examples which fulfil exactly one purpose, but I am looking for a whole project.
Last edited on
Playing Schedule: Just select a random team that has not been played before
Initializing: You just create the objects, the constructors will be called automatically
Hope it helps.
For the schedule, you could just store it in a file, and stick that in a map or multimap when you run the program. This way you can alter the schedule without recompiling.
Hi

Thanks for the answers!

I guess my question was not well formulated after all. :-) Sorry for that!

I actually know how to create objects and all that, I would also find a solution to let the program do what I want it to do. But what I don't know is how to do it in a well organized way.

So my question basically is, do I add a class Playing Schedule? Or how should I implement this? I will definitely have a look at map/multimap, because I didn't know this concept before. Thanks for the tip!

And for the initialization procedure, do I have a method init() which creates the objects? But of which class? Or should it be just a function?
Implementation is completely up to you. I would handle the schedule in an outside source (file or database) for easy manipulation, and either put the information in a multimap at run-time (could take a minute depending on size), or just read from the file/database at run-time (gets rid of the potentially long load time, but adds in a bunch of small file I/O operations).

An init() method is usually what happens in games. Something to initialize all the resources you'll need for the upcoming state.
Topic archived. No new replies allowed.