Macintosh Games ported to W10 with Claude

360alaska

New Tinkerer
May 18, 2022
19
13
3
So I gave Starbound to Claude and asked it, "could you please port this game to windows 10?"

Claude Successufully ported it in two attempts to windows 11

Claude:


StarBound now runs as a native Windows program. Unzip StarBound-Windows.zip and double-click StarBound.exe; nothing needs installing. Windows SmartScreen will probably warn because the program is unsigned: choose “More info”, then “Run anyway”. I tested it under Wine, not on a real Windows 10 machine.


How I ported it: I unpacked the StuffIt archive and Mac disk image and converted all the original pictures, icons, sounds and the in-game manual. I then disassembled the game’s 68k code and rewrote it in C, function by function. The rules, computer AI, combat odds, production, fog of war and random number generator follow the original code exactly, so the game should play like the 1994 version.


What I checked:


  • Full games: I played through the main paths: starting a game, building a ship, setting a path, colonizing, ship and planet combat, conquering, victory, saving and loading.
  • Simulated games: I ran several hundred automated games against the real game code with memory-error checking on. There were no crashes or hangs, players both won and lost, and saved games reload exactly.

Changes from the original:


  • Save As works. In version 1.0 that menu item did nothing.
  • At most 100 ships exist at once. The original had no limit and would corrupt its memory past 100.
  • Fonts are Windows stand-ins for the Mac fonts. The numbers on the map pieces use a built-in pixel font so they fit inside the hexes.
  • Combat and landing animations are redrawn to look like the originals, not copied pixel for pixel.
  • The window can be 1x to 4x the original size (View menu). Mac Command shortcuts became Ctrl, and the About and Manual items moved to the Help menu.

Original quirks I kept: I found a few bugs in the original code and left them in because they shape how it plays.


  • Tech upgrades cost twice what the manual says.
  • The spending bars add up to 76 points, not the manual’s 78.
  • A landing ship’s power counts Move twice and Detect not at all.
  • The AI has a couple of targeting mistakes that change how computer ships behave.

The read-me in the zip lists these too.


Saved games (.sbg) use the same byte layout as the Mac save files, so an original Mac save should open, though I had none to test with. StarBound-port-source.zip has the C source, a one-command build script, the extraction and disassembly tools, and my reverse-engineering notes, in case you want to change or rebuild anything.

1794636279444.png
 

Attachments

  • StarBound-Windows.zip
    693.1 KB · Views: 21
  • StarBound-port-source.zip
    886.6 KB · Views: 22

360alaska

New Tinkerer
May 18, 2022
19
13
3
1795117150410.png


Claude:


Here's the full list of changes in the port since the first build I sent you.


1. Flashing floor outlines (fixed)


  • The tan outlines along the wall and floor no longer flash.
  • Cause: when the game drew a colour, my code could pick one of the palette entries the game was cycling for the belts and glowing parts.
  • Fix: those cycling entries are never picked for normal drawing, which matches what a real Mac does.

2. Windows menu bar


  • The game's menus are now a standard Windows menu bar: File, Edit, Game, Help.
  • The Mac menu bar drawn inside the game screen is gone; its 20-pixel strip at the top stays black.
  • The Apple menu's "About Factory…" moved to Help, and Quit is now called Exit.
  • Menu items show their Ctrl shortcuts. Items grey out as the game enables and disables them, and every item is greyed while a game dialog is open.
  • The editor's extra menus (Layout, Assembly, Components) appear in the Windows menu bar while you're editing.
  • During a workday, items with a Ctrl shortcut work from the menu and act like pressing the shortcut. Items without one are greyed.
  • The Alt and F10 keys open the menu bar, as in other Windows programs.
  • The window height now includes the menu bar.

3. Graphics fill the window


  • The picture scales to fill the window at any size, including maximized, and keeps its 4:3 shape. Leftover space becomes black bars.
  • At exactly 2× or 3× it stays pixel-sharp; other sizes are lightly smoothed.
  • Mouse positions are mapped to the new scaling.

4. Windows-style dialog boxes


  • Window frames are a thin grey border instead of the Mac double or shadowed borders.
  • Movable windows have a plain title bar, with the name on the left in black (grey when inactive). The close box is an X on the right.
  • Buttons are flat grey Windows buttons and turn light blue while pressed. The default button gets a blue outline; the game's thick rounded Mac ring around it is no longer drawn.
  • Check boxes use a tick mark. Radio buttons are round with a filled dot.
  • Disabled items use grey text instead of the Mac speckled pattern.
  • Text boxes have a thin grey border that turns blue when you're typing in one.
  • The dialog font is plain instead of bold.

5. Windows mouse cursors


  • The pointer is now a real Windows cursor instead of one drawn into the picture.
  • The normal arrow, the busy cursor, the text cursor and the crosshair are the Windows ones.
  • The game's own pointers (the hand and the editor tools) keep their shapes as real Windows cursors at double size.
  • Hiding and showing the pointer works through Windows.

6. Other fixes (from the first round)


  • Quick key taps aren't missed during play. The game checks the keyboard state instead of waiting for key presses, so each key now counts as held for at least 4 ticks. This made Ctrl+P and Ctrl+D work reliably.
  • Opening months from other folders works. File > Open had shown "A disk error has occurred" because a mistake in my folder lookup sent it to the wrong folder.
  • Saving no longer rewrites resources that didn't change. It used to save some of them back in their changed in-memory state, such as the menus in the game's own file.
  • Changed files (preferences, registration, months) are written to disk when the game quits.
  • Closing the window asks "Quit Factory?" and saves first if you say yes.
  • If the game hits an error it can't recover from, it now shows a message box instead of closing silently.
  • Text boxes now handle multiple lines: wrapping, clicking, selecting and the up/down arrow keys.
  • Text drawing now uses the original Mac font measurements, so the evaluation screen and other columns line up.
  • The screen is only updated between finished frames, which removes flicker from half-drawn frames.
  • Glyphs were added for Mac characters that the bitmap fonts were missing, such as the bullet (•).
  • The game now gets an answer when it asks the system where its preferences folder is, so preferences go in the game folder.
  • The game uses about 3% CPU while waiting instead of spinning.

7. Package


  • The README was updated for the menu bar, Exit and scaling.
  • The original documentation was converted to plain text in the Documentation folder.
 

Attachments

  • preview.webp
    46.5 KB · Views: 0
  • Factory-port-source.zip
    493.2 KB · Views: 0
  • Factory-Windows.zip
    1.5 MB · Views: 0
  • preview.webp
    46.5 KB · Views: 1