Defense values for the next more experimental game (follow up to LT40)

Current and future games
Post Reply
wieder
Member
Posts: 1781
Joined: Thu Jan 01, 1970 12:00 am

Defense values for the next more experimental game (follow up to LT40)

Post by wieder »

Currently the LT40 ruleset gives an additional 50% defense if the unit is in city. Then additional 50% if the city is size 9 or bigger. Then another additional 50% if the city is size 20 or bigger. It might be more natural if this defensive value would grow each time the city grows but maybe yet more easy to understand if done with few increments. I'm not sure yet how the decimals are rounded but what if sizes 4, 8, 12, 16 and 20 would all give about 20% defense each? The base defense of 50% would remain.

For the cruise missiles and missiles there should be a building that would provide some defense against them. In LT40 this option was absent because of a bug in the ruleset. The cruise missiles seemed to be quite effective after all and most definitely relevant unlike in some previous games.

The cruise missile is like this:

attack = 20
defense = 0
hitpoints = 5
firepower = 2
move_rate = 15

Maybe the HP could be 4 instead of 5. And the defensive building against cruise missiles would provide 50% shielding against them. Not 100% like the city walls. This would make them slightly less powerful outside the cities and still viable against even the best cities. Also the move rate could be 12 instead of 15.
Corbeau
Member
Posts: 990
Joined: Thu Jan 01, 1970 12:00 am

Post by Corbeau »

I'd say that defence bonus should add 10% for each size. If I get the time, I'll put it into the LT42 ruleset.
wieder
Member
Posts: 1781
Joined: Thu Jan 01, 1970 12:00 am

Post by wieder »

That would require some calculations and also checking how the numbers are rounded. The defense values are not added but multiplied. 25% and 25% is not 50% but about 56%. Also 10% and 10% are actually 21%. However... Someone once told me that there may be rounding errors and I really don't know if 10% and 10% would actually make it 100%, 120% or 121%.
Corbeau
Member
Posts: 990
Joined: Thu Jan 01, 1970 12:00 am

Post by Corbeau »

I think the defence bonuses are calculated up to two decimals so no problem with rounding. As for multiplication vs. addition, it can be easily checked and then higher level city defence bonuses adjusted.

As for calculating... Well, tough luck. It's not rocket science, really, and in the end it all boils down to probabilities anyway so it doesn't have to be completely accurate.
wieder
Member
Posts: 1781
Joined: Thu Jan 01, 1970 12:00 am

Post by wieder »

With each city size adding to the defense value the rounding errors might end up with very unexpected results. Testing is also not so easy if one can't use a debugger for it. Like getting to size 20 and with 10% bonus each time on top of the 50% base bonus, you would end up with 917% defense bonus if there are no rounding errors. That might be too much compared to the current LT40 bonus of 338%. With additional bonus of 4% for each city size you would end with 316% base defense bonus for a city with a size 20. or 379% with 5% with each city size. Both 316% and 379% would be probably fine but without testing we can't be sure if we end up with those or with rounding down 4% to 0% or rounding 5% up to 10%. I'm really not saying the decimals wouldn't be calculated with 2 decimals but it would be needed to be tested somehow.
Corbeau
Member
Posts: 990
Joined: Thu Jan 01, 1970 12:00 am

Post by Corbeau »

I didn't mean to have the original 50% bonus. I meant to start with 10% from size 1 and continue with that.

But, again, it's all a matter of probability anyway and a little uncertainty would just be lost in that.

And the values *are* calculated within two decimals. That's what percentages are for.
wieder
Member
Posts: 1781
Joined: Thu Jan 01, 1970 12:00 am

Post by wieder »

How do you know the values are internally calculated with two decimals, all the time? From code point of view two decimals sounds kind of weird. In code the decimals are usually calculated with the max possible or there could be one or more phases without any decimals. Or the numbers without decimals are multiplied with 100 to allow calculations without decimals. There is actually a technical reason for that. Or more like has been in the past when the computers were slower.

In the past numbers with decimals were slow to calculate and the numbers without decimals were faster. That easily makes the coders to use integer (no decimals) numbers when while using floats (with decimals) would be just a fraction slower. I know it may not make sense but it's one common way of making bugs in code. There may be lots of phases when calculating this stuff and it's enough if one of the phases is not handled as it should be. This is why I'm usually quite cautious what it comes to trusting that the decimals are always handled properly.

You can of course set the base defense from 50% to 10% but what about the forts? Would it make sense to change those too? With a defense of 100% for forts the cities with size 7 would be almost as powerful defense structures as forts. That's a city with a population of 280 000.
Post Reply