I was just reading through the manual and I see some things that somewhat bug me - much of it I am also guilty for: Multi parameter settings. These should never have been allowed. When I get back to code cleanup, I'm going to take an object oriented approach to commands. Old commands will get an alternate, new commands will always use the new concept. Let's use attack boxes as an example.
Currently, we have attack1 {x} {y} {h} {w} {damage} ... with the in text command being attack1 50 40 30 25
The OOP version will look like this instead:
attack {param} {value}
Then the author puts this into text files:
attack Type 1
attack X 50
attack Y 40
attack H 30
attack W 25
attack Damage 10
Looks more complex right? But look again. Unlike the old style attack box command, the order you use for the OOP style attack box command doesn't matter at all. Switch it, swap it, the engine won't give two spits so long as the required stuff is there. It's also a lot simpler to read when you come back later (no more counting positions to see which parameter is which).
Now think for a moment about adding say, Z depth to your attack box. With the old version, it's the very last parameter, meaning you are forced to put in a dummy value for all the parameters in between. It's inconvenient and leads to potential problems down the road. With OOP style that's no longer the case. You just populate the required parameters like size, add whatever extras you want and forget the rest. So in this case, add attack Z {value} and you're done.
When we later want to expand the command with more features (like an index to allow multiple attack boxes...), no problem. It's just a matter of adding the option and old modules carry right on with a default. No sticking it onto the end of an ever growing and confusing multi-parameter line. No backward compatibility issues.
It will even help if we absolute HAVE to break backward compatibility for some reason. Let's say for we are forced to change Type to Hittype. With the old style you'd have to retro fit modules by hand. But with OOP, do a blanket copy/replace "attack type" with "attack hitype" for all text files in the data folder. Done.
As an added bonus, this will also have the effect of making editors much, MUCH easier to create and so we might see more start to show up. Thoughts?
DC
Currently, we have attack1 {x} {y} {h} {w} {damage} ... with the in text command being attack1 50 40 30 25
The OOP version will look like this instead:
attack {param} {value}
Then the author puts this into text files:
attack Type 1
attack X 50
attack Y 40
attack H 30
attack W 25
attack Damage 10
Looks more complex right? But look again. Unlike the old style attack box command, the order you use for the OOP style attack box command doesn't matter at all. Switch it, swap it, the engine won't give two spits so long as the required stuff is there. It's also a lot simpler to read when you come back later (no more counting positions to see which parameter is which).
Now think for a moment about adding say, Z depth to your attack box. With the old version, it's the very last parameter, meaning you are forced to put in a dummy value for all the parameters in between. It's inconvenient and leads to potential problems down the road. With OOP style that's no longer the case. You just populate the required parameters like size, add whatever extras you want and forget the rest. So in this case, add attack Z {value} and you're done.
When we later want to expand the command with more features (like an index to allow multiple attack boxes...), no problem. It's just a matter of adding the option and old modules carry right on with a default. No sticking it onto the end of an ever growing and confusing multi-parameter line. No backward compatibility issues.
It will even help if we absolute HAVE to break backward compatibility for some reason. Let's say for we are forced to change Type to Hittype. With the old style you'd have to retro fit modules by hand. But with OOP, do a blanket copy/replace "attack type" with "attack hitype" for all text files in the data folder. Done.
As an added bonus, this will also have the effect of making editors much, MUCH easier to create and so we might see more start to show up. Thoughts?
DC