r/howdidtheycodeit • u/MoyaiManTheFourth • Aug 11 '23
Question How did they code the smooth 2d dungeon crawling in phantasy star
https://youtu.be/imlbwFg9Peo
19
Upvotes
r/howdidtheycodeit • u/MoyaiManTheFourth • Aug 11 '23
7
u/nudemanonbike Aug 11 '23 edited Aug 11 '23
So, one thing I'm noticing is that if you look to the sides, it becomes apparant that they're just swapping between two frames to produce that animation - I wouldn't be surprised if the border of the screen has some simple logic, and then whatever's really close to the center is handled in a different, more power intensive way. They might just be stitching sprites together in a simple way. I can't speak authoritatively on this since I don't have any experience with the master system, however.
2
u/Amadeus_DW Aug 11 '23
While I don't remember the specifics, I remember that Clint Bellanger's Heroine Dusk gave me some insight into the process by reading the source to Heroine Dusk, specifically the map rendering parts. https://github.com/clintbellanger/heroine-dusk I think he may even have had a write up somewhere, but I'm not certain.
You could also look at the source to UAF (formerly Dungeon Craft) which is an adventure creator that emulates the old SSI Gold Box AD&D games which also used the same style of dungeons. https://github.com/grannypron/uaf
2
u/mrteuy Aug 11 '23
Check out “coding secrets” channel on YouTube. Old school programmer explains how he accomplished things like this on those older consoles.
4
u/Ratatoski Aug 11 '23
I have no idea but I love Phantasy Star 1! I spent years of my childhood with it on Master System. Had a battery glitch that reset the save files so never saw the end until playing it on emulator as an adult.
1
u/ProPuke Aug 12 '23
Let's look at the clues:
The master system supported 16 colours per sprite and tile, but most of this animation uses a very restricted number of colours. This indicates they were likely encoding multiple frames into each sprite and just rotating the colour palette to achieve an animation effect.
The floor and ceiling is identical, as are the side walls most of the time. So they likely just used enough sprites for a corner of the animation and then mirrored this horizontally and vertically for the other corners.
Most of it is just a repeating sequence:
You have the repeating sequence of moving down a straight corridor and the sequence of moving down a corridor with a turn.
When the turn was just on one side they'd have the straight sequence on one mirrored side the the corner sequence on the other mirrored side.
When approaching a back wall there is the sequence of it approaching. The back wall is a repeating tile pattern, likely allowing sprites to be reused again. They would have had separate sprite frames for each zoom level, likely encoded as a palette rotation again.
There's also the pretty rotation sequence - This one can't be mirrored from a corner so would have had to be a full screen worth of changing sprites. There appear to be 2 turn sequences:
So, to make all of this it was likely a case of careful grid paper planning, working out what all the unique sprites they needed were for each animated tile (bearing in mind they only had to think about a corner of the screen for most of it, and taking advantage of reuse of mirrors), and packing repeating animation sequences into the same sprite with palette rotation.
1
u/RogueStargun Sep 11 '23
This YouTube video explains how the effect was achieved on the Genesis https://youtu.be/OL3cuHoquUk?si=Z7TJzkj50gDl1unX
To pull the same trick with the even more limited master system doesn't require much imagination. The texture of the brick wall can be built from even simpler sprites, mirrored and rotated to save on ram
1
u/Far_Direction_3167 Jan 05 '24
https://youtu.be/Rd-K2F4sriQ?si=7jmaKhJiAhut4tSe
Click on the link above, click the link in the video's description. Download the projectfile(gamemaker studio 2.3+ needs to be installed for the projectfile to open). Study the code. Enjoy! :)
-2
u/Zerve Aug 11 '23
Looks like raycasting or a raycaster engine. Popular among psuedo-3d before Doom.