Make your own free website on Tripod.com

OldAug 19, 2004, 01:24 AM

  #1

brut

Chieftain

 

Join Date: Aug 2004

Posts: 9

combats


Hi there! I want to tell you about how battles work in colonization. I knew it when I was studing cheat mode. I believe you'll be interested it.

So, run colonization, choose
spain at viceroy level (i'll explain below why) and turn cheat mode on (alt - WIN). Reveal all the map. Create militia close to indian village. Attack indian village.

Let's see:
Combat analyses

-----------------------------------------------------
Soldiers 2
Attack bonus +50%
Spain bonus +50%

Soldiers +36 (*)
(following string contains a number, for example: +40) (**)

------------------------------------------------------
Braves 1
Village +50%

Braves +6 (***)
+42 (****)

How do you think, what numbers mean? Listen the answer.

(*) is attack value for random generator.
> Soldiers 2
Soldiers' strength is 2.
2 * K = 2 * 8 = 16
> Attack bonus +50%
16 * bonus1 = 16 * 1.5 = 24
>
Spain bonus +50%
24 * bonus2 = 24 * 1.5 = 36

In short,
Attack = Strength * K * bonus1 * bonus2 *...
where K = 8

Attack = 2 * 8 * 1.5 * 1.5 = 36

As consequence, two bonuses +50% better than one +100%

(***) is defence value for random generator. Algorithm is the same.
> Braves 1
Braves' strength is 1.
1 * K = 1 * 8 = 8
> Village +50%
8 * bonus1 = 8 * 1.5 = 12

Attention! There's hidden *bonus* -50% if unit's strength is one and it hasn't got rifles and its opponent has.
If you attack indian braves or foreign colonists with your scout then braves or colonists won't get rifle_bonus -50%
Artillery vs. unarmed unit will cause appearance of rifle_bonus to unarmed unit.


Defence = (1 * 8 * 1.5) * rifle_bonus = 12 * 0.5 = 6

(****) is sum of (*) and (***)
Sum = Attack + Defence = 36 + 6 = 42

Next, number (**) is random value from 1 to Sum. Let's call it Result.

If 1 <= Result <= Attack then attack is successful
If Attack < Result <= Defence then attack isn't succesfull

So, if Result = +40 then our militia demote to colonists status. If Result = +15 then our militia win the battle.


This combat system works for ships as well.

If you choose another level, governor or easer, you'll get some bonuses to combat.
Governor: +1 to your final attack/defence
Conquistador: +2 to your final attack/defence

Easer levels will get you even bigger K while your opponents won't.


I run my DOS colonization version under winXP and I have such a bug:
Result (**) in battles has to be RANDOM VALUE. Instead, this value is increasing consecutive from battle to battle and resets when it reaches Sum.

For example, my militia attack braves and Result is +5. Result in next battle of this turn will be +5, +6 or +7. Next - +6, +7, +8 or +9. And so on. So, there'll be line of WONS and then line of LOSES. And this is explanation of question:

>hirleyrocks
>
Jun 18, 2004, 03:42 PM
>I recently hauled out my DOS version of Colonization (version 3.0) and
>installed it on WinXP. Using compatibility mode the game works pretty well...
>the sound doesn't work, but the game is very stable, so I can't complain. I
>have run into a couple of bugs though, and I wondered if anyone else has
>noticed these...


>1) Combat 'streak' bug - I still haven't figured out the specifics on this, but
>I'm positive it exists. What happens is, during a given turn, you will win
>every single battle (at least those that you initiate...I'm not sure about
>battles the AI starts) *or* you will lose every single battle. I think moving
>on to the next turn 'resets' the streak, but a new win or loss streak will
>start right up on the next turn. This bug is a gamebreaker because after the
>first battle of any turn, you can predict the outcome of all other battles
>with 100% accuracy.
.....
>I was curious if anybody else had noticed these bugs and/or if they know of
>a way around them. Especially the combat streak bug. It makes the game
>unplayable



So, what do you think about it? Have you noticed this bug, or it depends on OS?


Last edited by brut : Aug 19, 2004 at 01:33 AM.

brut is offlineReport Bad Post 

Reply With QuoteQuick reply to this message

 

 

 

 

OldAug 19, 2004, 08:27 PM

  #4

brut

Chieftain

 

Join Date: Aug 2004

Posts: 9

I did it! Really, it was very interesting experience!
So, I know how to get rid of Random Generator Bug.

Do following.
1. Open viceroy.exe in your hex-editor.
2. Find such bytes: A3 EE 28 C7 06
3. Replace A3 with 5D, and EE with CB, so you get 5D CB 28 C7 06
4. Bug was removed!

In some days I'll make more comfortable patch in order not to work with hex editors but just run patch.exe

Enjoy!

PS The problem of Random Generator Bug was caused by too frequent calling randomize () that is syncronization of random seed with current time counter (0040:006C). If calling of randomize function is more frequent than time counter changes then random function returns almost the same value.


Last edited by brut : Aug 19, 2004 at 08:35 PM.

brut is offlineReport Bad Post 

Reply With QuoteQuick reply to this message

 

 

OldAug 23, 2004, 03:41 PM

  #5

brut

Chieftain

 

Join Date: Aug 2004

Posts: 9

I've made patch for colonization that fixes combat streak bug. You can download it there http://sixdays.narod.ru/canalization.zip

Edit:
1. I've attached patch to post.
2. Patch works for DOS and Win98 only.
3. To run patch under winXP launch "cmd" process in directory where colonization is placed and then type "start.bat". But sometimes the game freezes under winXP, so it's better to play under dos.

Attached Files

File Type: zip

canalization.zip (14.6 KB, 56 views)


Last edited by brut : Aug 23, 2004 at 05:11 PM.

brut is offlineReport Bad Post 

Reply With QuoteQuick reply to this message

 

This not only solves the 'combat streak bug', but also the fountain of youth bug.

 

OldSep 16, 2004, 04:56 PM

  #12

brut

Chieftain

 

Join Date: Aug 2004

Posts: 9

Quote:

Originally Posted by shirleyrocks

Can I ask how you figured this out? How did you know that those hex values related to the random number function?


First, I knew how battles work using cheat mode. Then I found out that results of battles depends on time, so 2 battles, fulfilled close to each other, had the same result ("random" value). But if you wait some seconds between battles last result will increase slightly. What does it mean? The game often synchronize its random seed with timer (by function randomize ()). But this's real bug because game must call randomize just once. So, the task was to take syncronization out from program code.

It's common known that DOS timer located at 40:6c (long word). SoftICE allows to trace reading from given address (bpm 40:6c r) and it wasn't problem to find out which instructions read timer. There was something like that:

random_seed = get_timer ();
random_seed = generate_random_value (random_seed);

Random function (generate_random_value) returns "random" value depending on random seed, and for 2 equal random seeds "random" values will be equal as well. Let's skip this instructions!
A3 EE 28 C7 06 - these are bytes of original instructions.
5D CB 28 C7 06 - these are our overpatching.

Don't think I know this instruction's code by heart, I just used softICE's possibility to assemble code in assembler language and then I wrote down obtained bytes.

But it wasn't end. Without randomize () the game worked better, but random generator was bad anyway. So I decided to replace game's random generator by my generator.

There's one good program, ArtMoney, it allows to find addresses in memory. I found address where battles result is written. Then I wanted to determine which code instructions write to this address. Unpleasant surprise - the address is part of program stack and too many different instructions write to this address. To solve this problem I defined breakpoint with such condition: writing to found address when ax is equal to 80h. 80h - attack value of attacking frigate. Then I attacked enemy frigate with my frigate. Bingo! Breakpoint executed and I found battle procedure. I checked it and found such instructions:

push ax
push 01
call ....:....

This's calling of function which takes two arguments: 1 and ax. ax keeps (attack+defence) value, so this function returns random value from 1 to ax.

Write own random generator's program and make it resident. Change instruction to call your own random function. Go to drink beer

There was many indescribable problems and devastating situations, but aim was reached.

Besides, I used cracked version of SoftICE. I know you don't like illegal programs but I can't buy such kind of stuff every time I want to have fun.

brut is offlineReport Bad Post 

Reply With QuoteQuick reply to this message