Decompiling classic CPC games

Hi folks.

I thought I’d give something a try.

I uploaded a snapshot of a famous isometric game to Claude, and then asked it (with some very specific criteria) to decompile the game from the snapshot, and rewrite it completely in BlitzMax, with the intention that everything (menus, in-game, sounds etc) work just like the original game.

Holy cow. In a bit over an hour, it was done, and the result is astonishing.

The resulting blitzmax code is easy to follow, and commented.

For anyone that is interested, this was my prompt (using Claude Opus 5.5’s Low setting):

hello.
decompile this.

i would like it ported to blitzmaxNG 0.165.3.61.

Port the ENTIRE program to blitzmax.
Very simple, clean, easy to follow code, and totally unoptimised.
Try to create an equivalent sound for every sound in the program.
Make it run in a window of 1280x800, where the cpc’s display is scaled up x 4.

no optimisation.
no fancy stuff.
just a straight 1:1 port.

no weird memory stuff for going through data, just simple arrays where possible.
the golden rule is to keep the blitzmax code AS SIMPLE AS POSSIBLE, and as readable and easy to follow as possible.

seriously, no fancy or “sophisticated” stuff at all!

3 Likes

… And the result?

Remember BlitzBasic and my first attemps to create a remake of Asphalt :slight_smile:

Any images to show ?

Here are some images.

[EDIT] Oops, I left the mouse pointer above the window when capturing the images!

1 Like

Same game effectivly, remakes will be easier to create.

I have tried with my game Bitume’s sources to migrate to my C++ framework with Direct2d (update of framework Direct3d i used to Hurlements remake for Windows). And it works of course.

1 Like

Again, another kind of game I was trying to mimic in a project by hand (creating a kind of Isometric framework for CPC)… Trying to learn on the way (even got some Jon Ritman article on it to read). And AI can just provide the code if I wish.

But it’s OK, it’s just ‘an implementation’ among others… I can keep going slowly (instead of slopely).

Did you plan to edit and use it as a base for another game? Or is it just for the beauty of porting it?

I’ve always been interested in how isometric games were made, especially given the hardware limitations. And the BlitzMax code is very easy to follow and will be very easy to learn from. AI has just given me a way to actually examine and understand how it works.

And I have to say, Jon Ritman is an absolute genius! The cause/effect relationship between objects in the game, the interactions between characters and objects, characters and surfaces, and characters and characters is remarkably deep and very nuanced. I never appreciated just how clever Head Over Heels really is. Not just a gameplay masterpiece, but a coding masterpiece as well.

Head Over Heels is my favourite CPC game of all time, so peeking behind the curtain is very special to me. I’m thinking of having Claude port Rasputin next…

1 Like

Don’t know Rasputin game, in esometric game, Fairlight impressed me a lot.

Hmmm. Fairlight is an interesting choice…

Rasputin.

This was done with GTP 6.1 Sol.

Not sure if the Shield and Sword energy are being displayed correctly. No matter.

I will try Fairlight next.

1 Like

How is GTP 6.1 comparing with Claude.AI ?

Claude feels a bit better for this sort of thing, but I’m going to do Fairlight with both Claude and GPT.

The BlitzMax code from each can then be compared.

First attempt by Claude (but now I need to wait for my usage to reset in 2 days).

Unfortunately the player character is a mess of pixels, and no control keys make him move.
Once my usage resets I will continue with it.

The room render is already ok, and there’s not performance problem in this kind of conversion.

1 Like

GPT’s version.

Seems to work nicely.

And the game speed can be changed via one simple CONST.

3 Likes

It’s a good idea to use a Basic oriented gaming, the code should be more readable than converted to C++ and keep only game logic.

1 Like

Rasputin is fixed.

1 Like

The resulting BlitzMax code from all 3 games is indeed very easy to understand and follow. I don’t yet know how I feel about it ethically, but as a learning tool it is tremendous.

There was already a similar issue with disassemblies game, but that still required a fair amount of technical skill within the context of CPC development.

That’s a very good point… however in this case I didn’t “earn” the right to examine how the games work. I just suddenly (and easily) have the ability to understand the algorithms used in these closed-source games.

Of course, the original source code is not available, and this is a reconstruction. But algorithmically it is likely a very valid representation of what the original developers had created. It feels like cheating.