Tiberian Sun: Tactical Advisor 2
11 04 2007I’ve put in more data (specifically, armour types, rate of fire, damage per burst, bursts per shot and warheads [which basically specify what percentage of the damage they ideally do is removed when encountering different types of armour]) and have written a few new functions. Three in particular will save me a lot of time:
[SNIP!] - looks like the “less than” symbol is interpreted by browsers as a tag opening which totally destroys the formatting of the page and causes most of the code not to display… screenshots of the first and second (the database-looking-up-…in-functions. The third is long and… you get the idea.
The first two basically look up data in my mass of arrays (they basically constitute a fat database). This is harder than it sounds because I was reluctant to make an array with more than two dimensions (it gets fiddly) so I made separate ones for unitInfo, weaponInfo and warheadInfo so to look up, say, the warhead used by Light Infantry, I have to first look up which weapon it used (simple) and then look in a different array for a weapon which has the same name as the one that my Light Infantry says he has (…fairly simple) and then look up which Warhead that weapon says it has and then check all Warheads to see if they have the same name and then retrieve their number and return it ARGH so it gets a bit odd but these two functions will save me a lot of time.
The last function is a neat damage calculator which essentially means fewer lines of code. I’m not sure why I didn’t program a standalone damage calculating function before, but it might’ve been because of the bias toward being unhittable and being able to kill enemies in one shot instead of how much damage would actually be done - I had no concrete data in version 1.
This version is still far from perfect and I’ll need to incorporate aircraft being unhittable by most weapons while in flight and change the way in which suggestions are printed (the recommendation values are no longer integers, and you can’t have a two-point-seven-sixth row. A two-hundred-and-seventy-sixth row maybe, but that’d make the page looong… rounding would defeat the purpose of exact stats. I think I’ll just print them in order in a single paragraph… lol.
I think Elliot is working on putting in more accurate data into the version 1 database - but I think I forgot to tell him that the recommendation rating - which is affected by stats - has to be an integer or the unit simply won’t appear in the suggestions box…
Anyway, I have made progress and will keep making it. And then upload it.
Pax







Recent Comments