Jump to content
  • Advertisement
Sign in to follow this  

Storing Objects in a game

This topic is 4773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, this is my first time post and the first time i really start to program a game :) Anyways i searched the forum but didnt realy found a propriate answer I'm making some kind of "operating system" in my game for the user. This operating system can run small games and programs that are deliverd with the game itself, let's say for example tetris and hangman :d How do i store most op the options for those programs? I was thingking about a class like monsters are stored in a game, but i'm not 100% familiar with this technique. Do i create the class object at the startup of my game or just when they are needed, for example when the user wants to starts the program (tetris). Thx in advance P.S. if my question is not clear tell me :)

Share this post


Link to post
Share on other sites
Advertisement
The question is troubled by using the term OS. What you probably want is a sort of command-line interface for launching certain games. Essentially this has little to do with OSs.

As for the design. Just sit down for an hour or so and write down, for each game, concepts that come to mind. Like monsters, enemies, weapons, levels, etc. Later on, revisit and consider each object more thoroughly. Then, even later, draw relationships and throw out concepts that don't fit.

This is an informal way of design, related to brainstorming. With some experience it will give reasonably good designs. However, experience comes with practice so just try a design you have worked out. Then, when it fails, find out why.

Both your suggestions seem quite good. Launching the game (i.e. instancing its main class) should in my opinion been done on launch from the command line and not beforehand. Also, Monster seems like a reasonable class for nearly any game design involving monsters.

Good luck. Greetz,

Illco

Share this post


Link to post
Share on other sites
Hey,

I was just doing that :)

But the thing is, the internal game concepts dont really matter, they are just a pointer to a form for the OS

i'll try to make that clearer:

First there is a list of programs the user can install, for example:
Name: Price: Version
Tetris 300 1
Encryptor 1500 3

When the user installs a program a class object is created:
Programs * Installed[10];
Installed[0] = new program;
Installed[0]->Name = "Tetris"; and all other options are red from a file

But the class program also has a member var wich is a pointer to the apropriate form called frmTetris.

Via this pointer the program can be started.

Is this a good way to do it??
The array installed is an array of object pointers, is this good??

There is just 1 other problem, the pointer to the form.
If the user was able to install 250 programs i would have to make
a tree of 250 if then else's
Is there any easyer way??

Oh yeah forget to say, i'm programming it in BCB 6.0

Greetz

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!