External Objects


Just needed some info / advice / suggestions on the follwing...

I have heard that keeping most values externally (as in a file that gets read in) is the best way to go as you dont have to recompile when tweaking settings.

Along the same lines, I was thinking of expanding on this thought and make actual objects in text files.

Here is an example: (quick and dirty)

class weapon
int range;
int damage;

class rifle::weapon
string name;
range = 15;
damage = 20;

I know syntax is way off, but given as an example. :)
in any case, so say I have 20 different weapons, normally I would create 20 different classes.

This made me think, what if I want 50 different weapons, or add new weapons in the future?

So, I started to think is there a way for the game to read in a file and make these classes while the file is not EOF?

so as an example, in a text file i have:


"Rocket Launcher"

would it be possible to iterate on this file to make the rifle object and a rocket launcher object and whatever else is there?

in addition, if i have 50 soldiers, 20 have rifles and the rest have various others... how would they use these objects?

Simply solved in classes by making the object for each soldier.
Rifle rifle1;
rifle1.assign (soldier1);

I know I am asking a lot, but any advice anyone can give would be greatly appreciated. (and credits will be given :) )
I have heard scripting languages (LUA / GameMonkey) could help. Is this a viable option?

Thanks in advance.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion