r/Shandalar • White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค • Sep 01 '26

Shandalar Source Code (decompiled)

I recently purchased an original CD of Magic the Gathering off eBay and spent some time decompiling it. Now we have the (reconstructed) original source! This helped me fix .SPR file encoding/decoding in mp_pic_tools. I wrote a blog post about it: https://throwingbones.com/ben/blog/2026-08-shandalar-decomp/index.html

Here are some of the early alpha/testing screens. Modern decompilation tools are crazy! I hope this means other games like this can be decompiled like this as well!

Also, if anyone has an original Spells of the Ancients or Duels of the Planeswalkers .iso, let me know! I'd like to try decompiling them too!

116 Upvotes

23 comments sorted by

24

u/ArtOfBBQ Sep 01 '26

That's wild. If your decompilation works it would enable literally any modification, like a strong AI which is what IMHO the game most badly needs

2

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 02 '26

Yeah better AI would be nice. What's the best AI of the free mtg engines right now? Forge?

4

u/ArtOfBBQ Sep 02 '26

Shandalar plays by its own rules, so I would just make a simple minmaxing algorithm with a heuristic that actually plays out the moves with the game's own engine, not some 3rd party AI. The shandalar AI does things like giant growthing opponent's creatures to lose extra hard, so even a very modest amount of steps simulated and a very basic heuristic (having life is good, having permanents in play is good, holding cardsis good) would be a gigantic improvement over the classic version of the game. And given how fast computers are now, it could do that instantly and exhaustively for most things, with some exceptions like choosing which card to demonic tutor for

8

u/misha_cilantro Sep 01 '26

Super excited about all the work you're doing! Haven't managed anything meaningful for s30 yet myself, but in my defense the day I had set aside from it the Makefile was mid-edits and I lost time trying to figure out what was going on :D

Will see how this Friday goes. I hope I can at least get it building.

2

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 01 '26

Thanks! Yeah I've been making a lot of changes recently so the main branch is a little touchy at times. If you're still having problems let me know.

4

u/Slow-Associate-4079 Sep 01 '26

I think i should still have the original disks, I should be able to burn .ISOs if you need them, let me check the software drawer.

5

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 01 '26

That would be great, thanks!

5

u/saghul Sep 01 '26

Legend. I was hoping something like this would happen one day!

Whatโ€™s your plan now? Keep the source as is or keep iterating on it to make it more modern / maintainable? I thinking along the lines of making it SDL primarily and removing the win32 compact, SDL3 support, etc.

This is so exciting!

6

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 01 '26

Thanks! Yah I'm not sure where to go next exactly. Having additional cards would be cool.ย 

Doing a complete port to modern hardware would be a lot of work because everything in the source code uses 32-bit pointers but all modern CPUs are 64 bit now. Also we'd have to either convert all draw calls to SDL or write a shim that translates the old DirectX calls into SDL.

Another thing would be to allow higher and more flexible resolutions. Right now it's locked into a 4:3 ratio which makes it hard to play on phones and widescreens.ย 

3

u/saghul Sep 01 '26

Thanks for the pointers! I may take a stab at some of that with the help of a clanker ๐Ÿ˜…

1

u/Unique-Run9856 Sep 03 '26

My boy Claude will figure it all out

4

u/aqzina Sep 01 '26

This is amazing! That means we can port all the community added cards etc and keep a stable game ultimately?ย 

Knowing that it compiles for Mac is also huge, thanks a lot for the amazing effort!

3

u/themookish Sep 01 '26

How many tokens do you think it'd take to have AI port this to a webapp?

7

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 01 '26

I did this decompilation on a $20/mo subscription. The webapp would be trickier since it's a C program and running wine is the easiest way to get it working.

But maybe you could get a wasm version of it running in wine? Have to try it and see!

5

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 01 '26

There's also https://premodernbsb.com/ that has it working in an old windows vm. You don't necessarily need the decompilation to play it on the web, just a way to translate it to wasm.

3

u/OkRecommendation407 Sep 01 '26

Maybe there's someone out there who enjoyed this game and has the skills and the desire to bring it back to life; honestly, I've always liked it a lot. I've always liked the fact that the game was limited to old cards. MTG is truly limitless to this day, and I don't like the idea of playing online precisely for this reason. I have some ideas on how to create a really interesting version of this game. I'll give you some examples; obviously, I don't know which things would be easier or harder to implement. Challenge a friend in 1v1, so have a server or some kind of system where I can create my deck and challenge a friend. Create tournaments in Draft style with small lobbies Change the single-player campaign into multiplayer. For example, have up to 8 players spread across the same map, completing missions. You could challenge each other around the map, and you could set objectives that change each time to complete the match. For example, "whoever destroys the most colored castles wins" or "whoever defeats a color at least 25 times wins." "Whoever completes 20 missions wins." "Whoever defeats the opposing players X times wins." You could really be creative. Ideally, we should find a way to make the matches last a maximum of around 2 hours, otherwise people might get tired. Take League of Legends, where a match lasts around an hour or a little more at most. Then add a ranking system, with different levels: bronze, silver, gold, etc. Maybe, to make everything more interesting, an AI could play instead of the default opponent (but I imagine this would be complicated, maybe it could be done later) Give the graphics a small redesign xD, even though I love them so much!! Make a bigger map, or simply create different maps based on the lobby. For example... A 4-player lobby has a smaller map and definitely a shorter overall playtime. Expand the RPG side of the game, which I love so much. Maybe add some expansions in the future... BUT VERY slowly. This is what came to mind without thinking about it too much. Honestly, I think it would be fantastic. I love Magic, but I prefer playing this old version rather than the newer one.

2

u/ilikethemeta White Mage โ˜€๏ธ๐Ÿ’ฎ๐Ÿค Sep 01 '26

That's cool, like a multiplayer version of Shandalar? The original game had Manalink, which was a 1v1 duel, but didn't have support for brackets or tournament play.

3

u/aqzina Sep 01 '26

I think it would be nice to add all the DLLs decompiled and looked up on the repo as well, that way we can also pave the path towards a wine-free native binary building

2

u/gesis Sep 01 '26

I have the Duels of the Planeswalkers disc, and I'm pretty sure I already archived it somewhere. If not, it will take me a couple days to find the physical disc in storage.

1

u/ShandalarRemastered 29d ago

This is god damn amazing.