now if you guys follow the channel
you'll know that we've covered the
impossible Port series before games like
Resident Evil 2 on the N64 doom on the
SNES The Witcher on the Nintendo switch
to name a couple but today we're going
to take a look at probably the most
fascinating and interesting Port I've
ever seen and that is Tomb Raider the
original 3D version from 1996 running on
the Game Boy Advance
[Music]
this is Tomb Raider running on the
Nintendo Game Boy Advance yes there are
already tomb raid games on the GBA but
these are 2D games and while they're
pretty good let's be clear we are
talking about the classic 3D action
adventure game that launched on the PC
Sega satin and Sony PlayStation all the
way back in
1996 this version running on the GBA is
known as open Lara and we will get to
the name and more about the project
shortly but for those that may be
wondering what you're seeing here is me
running the game all on a stock GBA via
an everdrive cart there are no other
tricks or magic here just the ROM and
the hardware and it's pretty impressive
so let's dive in and take a look at this
in more detail open Lara began 5 years
ago as a reverse engineering project for
the original Tomb Raider game with with
its initial focus on Modern Hardware
with a modern GPU it's a cross-platform
open- source implementation of the Tomb
raer engine and there's even a web
browser capable version that you can try
out as well open Lara is certainly not
anything new if you follow the Homebrew
circles the engine is available on many
platforms including the Raspberry Pi
Nintendo switch PlayStation VA original
Xbox and many others but the GBA version
brings many questions just exact L how
does the GBA manage to pull this off as
a quick comparison let's first take a
look at the GBA version running against
the Sony Playstation 1 and the Nokia
engage version of Tomb Raider the PS1
comes with dedicated 3D geometry
rendering and featured garage shading in
its hardware and its main CPU the R3000
runs at 33.86 MHz and has a 1 MB frame
buffer the Nokia Eng gauge features an
arm 4T architecture and runs at 104 MHz
the Nintendo GBA runs a 32-bit arm 7
tdmi at
[Music]
16.78% held open Lara developer known as
ex proger has pulled off the impossible
and of course I had to learn more about
it so I reached out to him to understand
exactly how this port was achieved it
starts in June of 2021 during the
development of open Lara ex proger was
unhappy with the project he felt like
that it had diverted too much away from
the original behaviors of the original
game and set out to re architect and
rebuild the logic of the original engine
to be as accurate as possible
effectively rewriting most of the open
Lara engine the goals were to be as
close to the original gameplay as
possible with the original behaviors of
enemies shooting and damage
calculations to test this rewrite he
would set himself some pretty hefty
milestones and the first of those would
be to Port the game to older platforms
which would include the Panasonic 3dio
and the Nintendo Game Boy Advance fellow
YouTuber hard for games showed off an
alpha version of open Lara running on
the 3dio at the end of last year but the
GBA version would present an entirely
different
challenge with no dedicated 3D Hardware
open Lara on the GBA was done entirely
in software using the CPU when I asked
about the feasibility of the GBA for the
port X proger was initially interested
in the GBA because of its interesting
Homebrew development scene and the
potential that it had had initial proof
of Concepts were made with the engine
running at around 10 frames per second
without any gameplay or objects on the
level and this is where he began to
optimize code and thanks to the very
fine GBA Dev Community he was able to
get the game running faster by
optimizing and iterating and some of
these optimizations would take full
advantage of the GBA Hardware the
biggest performance gain would be
rewriting critical parts of the code in
arm assembly and this would provide a
40% increase in
performance Additionally the Game Boy
Advance lacks any support for Native
floating Point numbers and integer
Division and for this pre-calculated
division lookup tables would be used and
placed in the gb's work Ram known as ew
Ram ew Ram would be used to also store
additional lookup tables and important
object data ew Ram however is external
RAM in other words it's not on the same
chip as the CPU this means that it's
sitting on a 16bit bus but there's also
another type of ram known as IW Ram this
is the internal work Ram which is on the
same chip as the CPU some of the lookup
tables and other critical parts of code
including the math functions and sound
mixing functions were stored in Iram
exclusively one of the most critical
features of the game is the light map
array and this is the 32 variations of
shading from a 256 sixc color palette
the light map array is placed at the
base address of IW Ram this means that a
load instruction in Assembly Language
can be saved because the Base address is
already known this is also done for
additional lookup tables for example the
division lookup table is stored at the
base address in ew Ram again this means
that the developer can save one ldr
instruction and it's these micro
optimizations that start to add up and
really affect the performance in the
right
direction but let's move on and talk
about the graphics all the rasterization
is done in software on the CPU as
mentioned and the game uses the native
Mode 4 resolution on the GBA this is a
fully bitmap mode running at 240x 160
with an 8-bit color pallet and
supporting page flipping earlier
versions of the engine would use the GBA
mode 5 which was 128 by 160 that was
cropped to 120x 160 and scaled
horizontally this mode would offer
better performance but unfortunately the
resolution looks much worse and some of
the comparison shots will show the
difference so in the end the developer
would settle on Mode 4 many
optimizations were also done on the 3D
viewport polygons were clipped before
rasterization and uses less range in the
division table with skips and checks for
for each scan line additionally there is
no Z buffer that's being used in this
port instead the developer uses the
painters algorithm which is a simple
algorithm to determine which polygons
should be visible and the ones that
should be removed from the viewport by
removing polygons that will never be
visible in the viewport this can not
only increase performance but it also
leaves additional memory available to do
other important tasks but the polygons
are not sorted by camera distance in
instead an ordering table is used and
this is very similar to the PlayStation
GPU which is designed to walk through a
link list of Graphics Primitives and
draw each one in sequence until it
reaches the end of the list xprog is
continuing to perform micro
optimizations to the code but there's
also a high level optimization that's
planned that should overall improve
performance quite significantly you see
the current version of open Lara that
you see here has the same data as the PC
version of the original Tomb Raider game
this means that textures don't have
reduced resolutions and there is no
reduction in Geometry detail the only
real difference is the view distance has
been reduced some outside rooms and
behind Windows of the home level have
been turned off and some static mesh
plants were also turned off as well but
everything else is pretty much the same
as the original version this means that
each level can be carefully profiled
with alterations to assets to take full
advantage of the gp's architecture and
limitations the full audio soundtrack
including all sound effects are included
in the game what this means is that
sound mixing will also take CPU Cycles
away from the 3D rendering and gameplay
Loop the GBA Hardware supports two PCM
8bit channels but in open Lara only one
of the channel is used to mix Four
active channels plus the music track
into it all software with the mixing
routine stored in IW
[Music]
Ram now for those people interested I
will leave link to the ROM in the
description below where you can download
and try it out for yourself it will work
on original GBA Hardware a reputable gba
emulator like mgba for example as well
as clone systems like the analog pocket
as you see behind me any one of those
three things will work just fine so try
it out for yourself now I will say that
this is not the complete version of Tomb
Raider or open Lara right now it's only
exclusively done for the first three
Demos in other words you get the first
two levels of the game and including
Lara's house now when I asked the
developer whether it would be feasible
to fit the entire content of the game
onto the GBA he said it would be he is
confident that the full game all the
levels including the FMV could
potentially fit onto a 32 megabyte GBA
ROM cartridge and that is pretty
impressive we'll just have to wait and
see if and when that actually eventuates
but that is a very promising piece of
information that the developer has let
us know about now before I go I also
want to be very clear about this cuzz
some people on Twitter were talking
about whether there's some type of fpga
Wizardry going on or maybe there's a
Raspberry Pi involved this is nothing
but code running on the GBA Hardware
there's nothing in the middle that's
helping this game push polygons or its
frame rate faster than it normally does
so this again is just a real piece of
technical Wizardry and fantastic
optimization that does take advantage of
the GBA strength and really understands
its limitations as well and potentially
now maybe we'll start to see ports to
older systems you know things like the
commodor omiga with a suitable 68060
processor for example really start to
you know cross my mind whether we can
start to see ports to older hardware and
have them run at a good level of
performance just in the same way as the
GBA version but we are going to leave it
here for this episode let me know what
you think about Tomb Raider running on
the GBA I still quite can't believe it
when I sit down and start playing it
it's just an amazing port and I can't
wait to see where this goes and we'll
definitely continue to cover this on the
channel as things progress but for now
we are going to leave it here for this
episode thank you so much for watching
if you liked it don't forget to put a
like on it and I'll catch you guys in
the next video bye for now
[Music]
care
[Music]