English Amiga Board Amiga Lore


Go Back   English Amiga Board > Main > Retrogaming General Discussion

 
 
Thread Tools
Old 01 August 2011, 02:50   #1
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
Lightbulb Captain Blood reverse engineering

Hello all,

Some days ago, i've launched in Steem a game i've played a lot 20 years ago.
This game, Captain Blood, has a very captivating atmosphere and talking with the aliens is very entertaining:
Click image for larger version

Name:	Pop Unknown.png
Views:	1237
Size:	13.5 KB
ID:	29233

After some long nights, i've finally recovered all my life fluids, thanks to the duplicates. On top of that, a nice girl on my dashboard.

But... I hadn't the feeling of accomplishment. Some aliens i encountered were still shrouded in mystery.
And I found intriguing the way the game handled the conversation between Blood and the aliens.

So i started disassembling the game and i found a script interpreter.
It uses an input (Blood symbols), some local and global variables and produces an output (the alien symbol).
I've developped a tool which exctracts the alien's script to something readable (for someone expert with the game).

You can find the result (>1mb) on my site: http://bringerp.free.fr/RE/ (direct link: http://bringerp.free.fr/RE/CaptainBlood/main.php5)

Be aware: it contains major spoilers! If you haven't finished the game and you mind playing it, stay away!

You may have some difficulties to understand how to interpret the script. I willl add some hints tomorrow about this.

Have fun!


***** UPDATE 07/03/2016 *****
The fractal engine used in the game along the raytraced landscape (when pressing a key) always fascinated me.

Then, even if i'm afraid of heavily optimized 68k code, i started reverse engineering the fractal engine in C# to understand how it was implemented.

Even if the asm code is not that bad to read, it's still massively optimized to efficiently draw the curves and to minimize the memory usage while having a feeling of an infinite landscape.

The fractal engine is a classic real-time midpoint displacement method using specific random number generator to give different landscape.
The canyon part is done by forcing some points in the curve, then applying the subdivision.
The raytracer uses the computed fractal during flight, computes another layer of fractal between the "blue lines" then colorize with shadow the landscape.

And... Some days ago, i had a crazy idea... The thing that is totally useless... but well, you know, doing it only to see if it can be done.
"And if i put the raytracer in place of the simple renderer during flight ??"

You can see the result in the following video (look at 0:33):
[ Show youtube player ]

PS: i know the term raytracer is not perfect because the engine does not cast rays like a real raytracer, but it still computes shadows.

Download link: http://bringerp.free.fr/RE/CaptainBlood/main.php5

Instructions:
- Left mouse button while dragging the mouse to change the horizontal and vertical motion of the Oorxx.
- 'V' key to stop any horizontal and vertical motion.
- Right mouse button while dragging the mouse forward/backward to speed up/down the Oorxx.
- <Spacebar> to toggle between classic and raytracer mode.
- 'B' key to toggle wireframe while in raytracer mode.

Last edited by Kroah; 08 March 2016 at 21:21. Reason: Fractal Engine update
Kroah is offline  
AdSense AdSense  
Old 01 August 2011, 11:06   #2
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
Some explanations about the scripts:
- there are 64 aliens split in 16 races (4 aliens for each race)
- there are 64 inhabited planets (1 for each alien)
- variables are 1 bit length (0 or 1)
- UpCom variables are initialized to 0 when the UpCom appears
- UpCom_RandomUnk_ButtonLeftHiddenBchg is a special variable, its value changes every seconds
- there are 16 scripts (1 for each race): every aliens of the same race share the same script
- orange color: conditional instructions
- yellow color: assignment instructions
- white color: conversation (& conditioned) instructions

Some variables meaning:
- UpCom_IsAlien#X: 1=you are talking to the Xth (up to 4) alien of the script race
- #A_RACE_#B_NAME.IsAlive: 0= the alien #A has been disintegrated or destructed with his planet
- #A_RACE_#B_NAME.IsNotDestructed: 0= the alien #A has been blown up with his planet
- #A_RACE_#B_NAME.IsAtWantedPlanet: 1= the alien #A (up to 64) is at his wanted planet
- #A_RACE_#B_NAME.IsThere: 0= the alien #A will not show up in the UpCom (he is hidden)
- <=4PlanetsDestroyed: 1= the player has destructed less than 5 planets

The interpreter:
- when Blood enters a list of symbols, the interpreter executes the script of the race from the beginning
- if a conversation instruction (=sentence) is "accepted", the alien replies with the sentence and the script will execute the remaining instructions when Blood will click on the mouth
- a sentence is accepted depending on its words:
- if no word is underlined the sentence is always accepted
- if words are underlined with light blue (cyan) then the sentence is accepted if the input contains ALL the underlined words (whatever the order of the words)
- if words are underlined with blue, the sentence is accepted if the input contains at least 1 of these underlined words
- if words are underlined with light green, the input must match exactly the sentence
- if a sentence is accepted the next assignment instructions are executed, otherwise they are ignored
- grayed out words are not shown in the reply (those words are only used for matching purpose)
- if all words are grayed out, the reply is empty and the mouth is automatically clicked
- [1x] means the sentence will be said only 1 time (reset when UpCom is initialized)
- [%] means the instruction is randomly ignored
- the interpreter stops when the script reaches the end, waiting for another input

Last edited by Kroah; 01 August 2011 at 14:21.
Kroah is offline  
Old 01 August 2011, 15:47   #3
Paul_s
needs more ice cream

Paul_s's Avatar
 
Join Date: Nov 2006
Location: Amigaville
Age: 39
Posts: 3,160
Quote:
Originally Posted by Kroah View Post
On top of that, a nice girl on my dashboard.
that can't be comfortable.
Paul_s is offline  
Old 01 August 2011, 16:52   #4
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
Quote:
Originally Posted by Paul_s View Post
that can't be comfortable.
I agree, i should ask her... need a pillow?

To clarify, for those who haven't played Captain Blood, i talk about the ondoyante girl in the game... hum, or not...
Kroah is offline  
Old 02 August 2011, 19:14   #5
demoniac
Registered User
 
Join Date: Jul 2005
Location: -
Posts: 1,268
I restarted this game few yrs ago. I decided to follow a walk-thru to save time, but ended up going to some planet not on the walk-thru and met an ondoyante girl that was too happy to please. I stopped at this point as I wasn't sure if I wanted to continue on the original path or continue with the ondoyante and see how the game's ending would change. Never found the time to continue.
demoniac is offline  
Old 07 August 2011, 19:37   #6
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
If anyone interested, I have added some information about:
- the wireframe fractal engine
- the aliens digitized speech
Kroah is offline  
Old 31 August 2011, 23:01   #7
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 813
He's back http://captainbloodlegacy.blogspot.com/
Kamel
kamelito is offline  
Old 07 March 2016, 01:14   #8
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
Updated my first post with the fractal engine, check it out !
Kroah is offline  
Old 07 March 2016, 01:34   #9
Overflow
Registered User

 
Join Date: Nov 2014
Location: Norway
Posts: 297
Looks very nice!

Loved the game back in the days, and its one of those few gems that have that special atmosphere. The menu graphics and music really captivated me.
Overflow is offline  
Old 07 March 2016, 13:47   #10
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 813
Awesome, can you make it at 50/60 fps?
Kamelito
kamelito is offline  
Old 07 March 2016, 15:25   #11
Dunny
Registered User

Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 732
Any chance we could see the source for this? I'd love to mess around with it

D.
Dunny is offline  
Old 07 March 2016, 16:44   #12
Aegis
Gentleman

Aegis's Avatar
 
Join Date: Dec 2015
Location: The Fortesque Mansion
Posts: 235
Send a message via Skype™ to Aegis
That's fantastic! I always loved the aesthetic of the Captain Blood fractals, just never really got into the game - seeing it in motion is really cool
Aegis is offline  
Old 07 March 2016, 22:44   #13
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 813
This remind me of MasterBlazer fractal demo done by Achim Moller on Amiga. I thought back then that this was the sign of an upcoming Rescue on Fractalus release for the Amiga.
Start at around 2min.
[ Show youtube player ]

Kamelito
kamelito is offline  
Old 08 March 2016, 00:10   #14
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
Quote:
Originally Posted by Dunny View Post
Any chance we could see the source for this? I'd love to mess around with it D.
I've updated my website with the Fractal Viewer.

Be aware my coding skills are as high as the number of comments in the source code .

Quote:
Originally Posted by kamelito View Post
This remind me of MasterBlazer fractal demo done by Achim Moller on Amiga. I thought back then that this was the sign of an upcoming Rescue on Fractalus release for the Amiga.
Start at around 2min.
[ Show youtube player ]
Hum... You know what ? I've so much played the Atari 800 XL version that i never knew of this amiga version .

It really seems the intro has been made from the disassembly of Rescue on Fractalus. Too much similarities to be made from scratch imho. Thanks for the heads-up!

Quote:
Originally Posted by kamelito View Post
Awesome, can you make it at 50/60 fps
Well, the viewer is a C# program running on a PC, you can put whatever fps you want (and recompile) if your PC can handle it, and my old PC can run it at 60 fps easily.
Kroah is offline  
Old 08 March 2016, 21:22   #15
Kroah
Registered User

Kroah's Avatar
 
Join Date: Apr 2009
Location: France
Age: 40
Posts: 112
Sorry, but totally forgot to put the instructions for the Fractal Viewer:
- Left mouse button while dragging the mouse to change the horizontal and vertical motion of the Oorxx.
- 'V' key to stop any horizontal and vertical motion.
- Right mouse button while dragging the mouse forward/backward to speed up/down the Oorxx.
- <Spacebar> to toggle between classic and raytracer mode.
- 'B' key to toggle wireframe while in raytracer mode.
Kroah is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Speedball 2 reverse engineering & remake Kroah Retrogaming General Discussion 18 14 April 2015 21:34
Gods reverse engineering Kroah Retrogaming General Discussion 68 26 August 2013 13:28
Cadaver reverse engineering Kroah Retrogaming General Discussion 8 11 November 2011 09:35
Reverse engineering wiki copse Coders. General 9 14 December 2009 01:25

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:57.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.23095 seconds with 13 queries