Kroah's Game Reverse Engineering Page

 

~ Captain Blood ~

You are here:  
  • Home
    • »  Captain Blood
      • »  Main

Main

Captain Blood - Bridge Captain Blood - Buggol

You will find here some information concerning the game Captain Blood.

The main reverse engineering work has been done on the ingame interpreter used by the UpCom to talk with the aliens, the realtime fractal engine and the landscape raytracer.

  1. The Interpreter

    The interpreter executes a script from the beginning when the UpCom is activated and each time Blood enters a new sentence.

    • The input is the sentence entered by Blood.
    • The output is the alien reply.

    When the alien replies a sentence, the interpreter is suspended until Blood clicks on the mouth. Then the interpreter is resumed at the position it was suspended.

    The interpreter uses 3 main groups of instructions:

    • Conditional instructions (if)
    • Sentence matching: if the matching conditions are met, the alien replies with the sentence and the following assignement instructions are executed.
    • Assignement instructions (=): executed if the previous sentence or condition is accepted

    The variables:

    • They are 1 bit length (1=true or 0=false)
    • Some variables are local to the UpCom session, some are global to the game.
    • Variables beginning with "UpCom" are local. "UpCom_Var" variables are initialized to 0 when the UpCom is activated.

    Examples:

    Variable name Meaning
    UpCom_IsAlien#X 1 = you are talking to the Xth (up to 4) alien of the current 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 destructed with his planet
    #A_RACE_#B_NAME.IsAtWantedPlanet 1 = the alien #A is at his wanted planet
    #A_RACE_#B_NAME.IsThere 0 = the alien #A is missing and can't be talked to
    <=4PlanetsDestroyed 1 = the player has destructed less than 5 planets

    The script executed by the UpCom depends on the race of the current alien. There are 16 scripts, 1 for each race:

    Izwal Buggol Migrax Croolis-Ulv
    Croolis-Var Yukas Torka Trauma
    Tricephal Sinox Antenna Tubular-Brain
    Tromp Robhead Kingpak Duplicate

    The full 16 scripts compiled in 1 page: 16 scripts

  2. The Fractal Engine

    Captain Blood - Oorxx flying
    The Oorxx flying above the planet

    When the Oorxx flies above the planet, the terrain is computed in realtime. Some games on 8 bits systems have a similar wireframe fractal engine: Rescue on Fractalus, Koronis Rift, The Eidolon.

    The procedural terrain generator uses 1D fractional brownian motion (fBm) with random mid-point displacement. Up to 10 curves are displayed on screen.

    When a new curve appears at the horizon, 7 vertices are computed. Then mid-point displacement with fBm are applied to thes 7 initial points. This results in a discrete curve of 512 samples.

    The random number generator and the fBm Hurst parameter H are adapted according to the current terrain type (flat, canyon...). This gives very different visual landscapes (plains, moutains, desert...).

    No more fractal computation is done on the discrete curve. When a curve is drawn, only 256 of the 512 samples are used (according to the position of the Oorxx).

    The view is 256 pixels wide, so if the visible part of the curve is larger than the 256 samples, the curve will be drawn zoomed with pixels linearly interpolated between the samples. Otherwise the curve will be drawn shrinked without any interpolation and using only some of the 256 samples.



    The raytraced fractal landscape is computed from these 10 curves.

    Captain Blood - Fractal landscape
    A raytraced fractal landscape

    For each pair of the 10 curves (1-2, 2-3, ..., 9-10), 50 curves are computed in between using random interpolations. Then the raytracer colorizes each strip, applying shadow when needed:

    Captain Blood - Starting point of the raytracer
    Starting point of the raytracer


    Captain Blood - Intermediate result: 50 interpolated random curves between each of the 10 curves
    Intermediate result: 50 interpolated random curves between each of the 10 curves


    Captain Blood - Final result of the raytraced fractal landscape
    Final result of the raytraced fractal landscape


    The above screenshots have been made with the Fractal Viewer of my reverse engineered work of the Atari ST version.


    The next logical step has been to adapt the viewer to use the raytracer in real-time during the flight as you can see in the following video.

    Because the raytracer computes the intermediate curves every frame and the 10 curves move at different speed horizontally to fake a depth perception, you will see some glitches when moving left or right (the points of the curve pair are shifted, giving different starting and ending points for the interpolation).



    A video showing the Fractal Viewer in action, using the 3 different rendering methods (original, intermediate and raytraced)

    You can download the Fractal Viewer and its C# source code here (it requires the Microsoft Framework .NET 3.5):

    [07/03/2016] Fractal Viewer - v1.00.zip (source + binaries):

    • Initial release.

    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.
  3. The Digitized Speech

    Captain Blood uses digitized speech through the whole game.

    The game contains 17 samples. Some are words, others are sound effects:

    • Words: space, vision, planet, galaxy, map, destroy, Oorxx, landing, teleport, desintegrate, activated, hyper, up, com
    • Effects: engine (long), engine (first half), engine (second half)

    Samples are played together to form sentences:

    • Galaxy Map Activated
    • Destroy Planet Activated
    • Oorxx Landing Activated
    • Desintegrate Activated
    • Teleport Activated
    • Vision Planet Activated
    • Vision Space Activated
    • Up Com Activated
    • Vision Oorxx Activated
    • Hyper Space Activated

    The sound engine has 3 main features, it can:

    • play a sample at a choosen frequency. A higher frequency gives a fast and high voice. A lower frequency gives a slow and low voice.
    • start playing a sample at a specific memory location for a specific duration. All the samples are adjacent to each other in memory (forming 1 block), without additional data between them. They could be played from the first to the last in one go without any glitches.
    • play a sample reversed (yes, from end to start, reversed!).

    These 3 features are the core of the aliens digitized speech.

    • Each alien race has its own voice frequency.
    • Each symbol is made up of 2 syllables. Each syllable is defined by 2 values:
      • a value indicating if the syllable is played reversed or not
      • an index used to compute the start offset of the sample in the "contigous sample memory block" seen previously (offset = index * 1437). To give a reference point, the word Vision has a length of 3488 bytes.

    Every syllables have the same memory length of 1024 bytes, but the frequency with which they are played makes them shorter or longer.

    This is a very ingenious system, building a language on top of existing samples.

  4. The Aliens

    There are 64 aliens in the game, split in 16 races (4 aliens per race).

    Race Planet Alien #
    IzwalBow-BowSmall Yoko1
    Idea 347No No2
    Idea 762Small Friend3
    Rendez-Vous 67Maxon4
    BuggolSpirit 137Pop Unknown5
      6
    RoskoMorlock7
    Rosko 2Good Unknown8
    MigraxReproduction 14Great Bounty9
    Reproduction 128Missile Brave10
      11
      12
    Croolis-UlvTrap 4Dead Genetic13
    Great TrapGreat Destroy14
    Bad TrapHowdy Prison15
    (Insult) 80(Insult) 416
    Croolis-VarTrap 2Good Nonsense17
    Great FearMale Warrior18
    Kill YouBad Crazy19
    Trap 1Poor Genetic20
    YukasFemale 021Yukas21
      22
      23
      24
    TorkaPlanet SpiritOndoyante25
      26
     Trauma Good27
    Corpo 28
    TraumaImpossibleTrauma 129
      30
      31
      32
    Race Planet Alien #
    TricephalSmall HomeGood Friend33
      34
      35
      36
    Sinox128Good Spirit37
    256Brain Radioactivity38
      39
      40
    AntennaKristo 15 41
    Kristo 7 42
    Kristo 34 43
    Kristo 08 44
    Tubular-Brain Brain 445
      46
      47
      48
    Tromp  49
      50
      51
      52
    Robhead145 53
    264 54
    387 55
    403 56
    Kingpak  57
      58
      59
      60
    Duplicate Duplicate 1 & 561
     Duplicate 262
     Duplicate 363
     Duplicate 464
Visitors visitors since 05/01/2006. Sitemap
Copyright © 2006-2016 by Kroah. Total or partial reproduction forbidden.
All trademarks and copyrights are the property of their respective owners. All rights reserved.
Email Me      Get Firefox Powered by PHPEdit      Valid XHTML 1.1 Valid CSS