command-and-conquer icon indicating copy to clipboard operation
command-and-conquer copied to clipboard

use a database for unit & building parameters.

Open jovoud opened this issue 13 years ago • 5 comments

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.

jovoud avatar Jan 27 '12 16:01 jovoud

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.

jakemac53 avatar Jan 27 '12 16:01 jakemac53

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

adityaravishankar avatar Jan 27 '12 17:01 adityaravishankar

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 avatar Jan 27 '12 17:01 jovoud

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.

jakemac53 avatar Jan 27 '12 17:01 jakemac53

units: http://xhp.xwis.net/isu_data.html

jovoud avatar Jan 28 '12 10:01 jovoud