use a database for unit & building parameters. #40

Open
jovoud opened this Issue Jan 27, 2012 · 5 comments

Comments

Projects
None yet
3 participants
@jovoud

jovoud commented Jan 27, 2012

Shouldn't it be easier to create a unitManager and buildingManager object that create the units and buildings using db files?
In the sourcecode you have lot of this:
[code]
'tiberium-silo':{
name:'tiberium-silo',
label:'Tiberium Silo',
powerIn:10,
cost:150,
sight:2,
hitPoints:150,
imagesToLoad:[
{name:'build',count:20},{name:"healthy",count:5},
{name:"damaged",count:5},{name:"ultra-damaged",count:1}],
gridShape: [[1,1]]
},
'hand-of-nod':{
name:'hand-of-nod',
label:'Hand of Nod',
powerIn:20,
cost:300,
sight:3,
hitPoints:400,
imagesToLoad:[
{name:'build',count:20},{name:"healthy",count:1},
{name:"damaged",count:1},{name:"ultra-damaged",count:1}],
gridShape: [[0,0],
[1,1],
[1,1]]
},
[/code]
It's not that hard to create a manager which builds these object using xml files or some other kind of file or db.
Makes it easier to add units and change values + if people later on want to create mods based on this game, it's much easier.

@jakemac53

This comment has been minimized.

Show comment Hide comment
@jakemac53

jakemac53 Jan 27, 2012

This could be part of the level editor which is also planned I believe. In order to really support this there would need to be a lot of restructuring of the code though to make all objects a bit more generic. Right now vehicles/infantry/etc all are completely their own objects and don't inherit from a base object. As well the draw functions need to be standardized and their needs to be a way to support special objects that aren't just a single sprite with that (like tanks which have swiveling turrets).

I think the best way to start down this path would be to make a generic "sprite" class that all the other objects build on top of. It would include all the basic draw functions and such, and then we could just a provide a standard way of overriding those when necessary.

This could be part of the level editor which is also planned I believe. In order to really support this there would need to be a lot of restructuring of the code though to make all objects a bit more generic. Right now vehicles/infantry/etc all are completely their own objects and don't inherit from a base object. As well the draw functions need to be standardized and their needs to be a way to support special objects that aren't just a single sprite with that (like tanks which have swiveling turrets).

I think the best way to start down this path would be to make a generic "sprite" class that all the other objects build on top of. It would include all the basic draw functions and such, and then we could just a provide a standard way of overriding those when necessary.

@adityaravishankar

This comment has been minimized.

Show comment Hide comment
@adityaravishankar

adityaravishankar Jan 27, 2012

Owner

True...

And that should be the eventual destination... But writing it in JS for the
first couple of objects in each category is the simplest way to design the
objects....

Once the design gets stable, and we are ready to extend to all
units/buildings is when the transition needs to happen....

This is just a reasonable intermediate stepping stone :)

True...

And that should be the eventual destination... But writing it in JS for the
first couple of objects in each category is the simplest way to design the
objects....

Once the design gets stable, and we are ready to extend to all
units/buildings is when the transition needs to happen....

This is just a reasonable intermediate stepping stone :)

@jovoud

This comment has been minimized.

Show comment Hide comment
@jovoud

jovoud Jan 27, 2012

sound good :). As far for the level editor.. I think first the conventions of the map and the generics of sprites needs to be taken care of. Else if they change afterwards, all the maps created for that version are useless...

jovoud commented Jan 27, 2012

sound good :). As far for the level editor.. I think first the conventions of the map and the generics of sprites needs to be taken care of. Else if they change afterwards, all the maps created for that version are useless...

@jakemac53

This comment has been minimized.

Show comment Hide comment
@jakemac53

jakemac53 Jan 27, 2012

totally agree, I think really a major restructuring of the code and objects is in order... and then we can work on a level editor/unit builder once the standard is in place.

totally agree, I think really a major restructuring of the code and objects is in order... and then we can work on a level editor/unit builder once the standard is in place.

@jovoud

This comment has been minimized.

Show comment Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment