Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - POC: simple 3D canyon demo

Reply to topic
Author Message
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
POC: simple 3D canyon demo
Post Posted: Tue Mar 29, 2022 7:19 pm
In response to many suggestions that I start with a very simple project, I'm just going to attempt a very simple canyon demo that got me motivated to show off 3D effects on the SMS in the first place.

Any help in these steps would be greatly appreciated, but here is the basic concept:
1. Draw the canyon background tiles: one set for the canyon floor and another for the precipice (since the top is exposed to direct sun, while the floor is far away and shaded). A third set of tiles would be needed for the canyon walls, but I am thinking of doing these as a simple dithered color tile.
2. Draw to the screen the 8x16 sprites that will form the columns of canyon wall sides.
3. Move canyon wall sprites in parallax horizontally as the player moves from left to right on the screen, creating that 3D effect.
4. Move the canyon wall sprites in parallax vertically to show the top of the canyon moving more quickly than the floor below.
5. Update the code to have the canyon scroll downward to give the appearance of forward travel by the player.
6. Update the code to allow the player to move up and down vertically within the canyon, having the canyon wall sprites move apart depending on where the helicopter is.
7. Draw scaled background tiles to improve the effect of ascending and descending into the canyon.

Here's a video of Thunder Blade arcade showing off these visual effects at 60fps:


This project would be a mini demo that is broken up into 7 microprojects, but I would appreciate help with any part of this. Is Pro Motion NG good for actually drawing the canyon floor background tiles? I have more experience with GIMP, but it doesn't seem like it's designed for making 8-bit games and artwork.

  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Tue Mar 29, 2022 8:41 pm
maxxoccupancy wrote
In response to many suggestions that I start with a very simple project, I'm just going to attempt a very simple canyon demo that got me motivated to show off 3D effects on the SMS in the first place.

Any help in these steps would be greatly appreciated, but here is the basic concept:
1. Draw the canyon background tiles: one set for the canyon floor and another for the precipice (since the top is exposed to direct sun, while the floor is far away and shaded). A third set of tiles would be needed for the canyon walls, but I am thinking of doing these as a simple dithered color tile.
2. Draw to the screen the 8x16 sprites that will form the columns of canyon wall sides.
3. Move canyon wall sprites in parallax horizontally as the player moves from left to right on the screen, creating that 3D effect.
4. Move the canyon wall sprites in parallax vertically to show the top of the canyon moving more quickly than the floor below.
5. Update the code to have the canyon scroll downward to give the appearance of forward travel by the player.
6. Update the code to allow the player to move up and down vertically within the canyon, having the canyon wall sprites move apart depending on where the helicopter is.
7. Draw scaled background tiles to improve the effect of ascending and descending into the canyon.

Here's a video of Thunder Blade arcade showing off these visual effects at 60fps:

This project would be a mini demo that is broken up into 7 microprojects, but I would appreciate help with any part of this. Is Pro Motion NG good for actually drawing the canyon floor background tiles? I have more experience with GIMP, but it doesn't seem like it's designed for making 8-bit games and artwork.


A good first step would be to draw a simple, non-moving, image of the canyon on the background.

Given that, there are many ways to implementing the canyon, each with its own limitations:

- If the scrolling is changed to horizontal, it would be possible to use raster interrupts to change the horizontal scrolling every few lines, similar to what is done on the second level of Sagaia:

- Using either horizontal or vertical scrolling, it would be possible to use tile animation to simulate parallax, similarly to what Astro Force does in some of the stages:

- Yet another option would be to use chunky scrolling, like in the ZX Spectrum version of Thunder Blade:

- Yet another option would be to use a short video loop to look like a canyon, like in Iridion II:

As for which paint program to use, Gimp works pretty well, as long as you use the indexed color mode; I use it for most of my projects; never used Pro Motion NG before, but it looks like a pretty good option for pixel art.
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Tue Mar 29, 2022 9:10 pm
Last edited by haroldoop on Tue Mar 29, 2022 9:46 pm; edited 1 time in total
Here's a mockup of how the FMV could look like.

For the record:
- An online tool was used to convert a single second of the Youtube video to a 1 second, 12 FPS GIF: https://gifrun.com/youtube/?v=B11rcIQfUGM
- Then, another online tool was used to convert the GIF to a PNG spritesheet: https://onlinegiftools.com/convert-gif-to-sprite-sheet
- Then, RgbQuant was used to reduce the colors and tilecount of the PNG, to use only 256 tiles: http://www.haroldo-ok.com/RgbQuant-SMS.js/RgbQuant-SMS.js/demo/index.html
- Finally, another online tool was used to convert the sprite sheet into a GIF: https://onlinegiftools.com/convert-sprite-sheet-to-gif

--- edit ---
For reference, I also added a mockup based on Iridion II

  View user's profile Send private message Visit poster's website
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Tue Mar 29, 2022 9:38 pm
For an overhead shooter moving from left to right, this form of parallax scrolling works well and looks really good. It also leaves all 64 sprites open for building your ship, enemy characters, etc. It's also been well proven, and we have a really good idea of what it would look like. And this demo plays at 60fps.


One problem is trying to speed up and slow down, but that's not that difficult. You can even turn your ship/helicopter around and fly backward. And it can all be taken from digitized photos of existing canyons like the Grand Canyon and look fairly realistic.

However, the problem remains that you can't ascend and descend and still have something look 3D. There may be a way that I'm just not thinking of to replace some of the vertical canyon tiles with canyon floor tiles, then change the location of line interrupts as the canyon changes in width and shape throughout the stage.

However, as the ship descends into the canyon, the idea is to have the canyon walls move apart in real time, to have the canyon floor grow larger to look like you're descending into it. Background tiles only draw onto a grid of 8x8, so smooth movement like that is impossible with the Grey Lancer style scrolling.

It sure would look good, though.
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Tue Mar 29, 2022 10:07 pm
If strictly horizontal scrolling was used, this demo could be used as a basis:
https://www.smspower.org/Homebrew/RasterParallax-SMS
  View user's profile Send private message Visit poster's website
  • Joined: 23 Aug 2009
  • Posts: 213
  • Location: Seattle, WA
Reply with quote
Post Posted: Tue Mar 29, 2022 10:23 pm
PC Engine Thunder Blade does some chunky, asynchronous updates for theirs. I don't know why, but I don't remember this bothering me as much playing it live as it does watching this video:

  View user's profile Send private message
  • Joined: 01 Feb 2014
  • Posts: 877
Reply with quote
Post Posted: Wed Mar 30, 2022 6:16 am
maxxoccupancy wrote
Is Pro Motion NG good for actually drawing the canyon floor background tiles? I have more experience with GIMP, but it doesn't seem like it's designed for making 8-bit games and artwork.


Pro Motion is one of the best, if not the best, Programs for producing pixel-based graphics. It gives you full control over the palette and is a wonderful tool for animations.

However, if you feel more comfortable with GIMP, then just use that. It does the job well enough and you will get better results faster than if you need to learn using Pro Motion efficiently first. Always use what's most comfortable for you. Sometimes I do sprite work in Photoshop, not because it's particularly well-suited for that (it's not), but because it's a program I work with every day, so I can get results very quickly.
  View user's profile Send private message
  • Joined: 04 Jul 2010
  • Posts: 540
  • Location: Angers, France
Reply with quote
Post Posted: Wed Mar 30, 2022 6:30 am
As Kagesan say, pro motion is very good.
Also asesprite or graphicsgale (both dedicated to pixelart). On not dedicated side ; photoshop, GIMP, the good old paint shop pro...

Personnaly i use photoshop for more than 20 years, so i naturally use it.
Tool will do nothing magically, use the one you prefer even if not perfect.
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Wed Mar 30, 2022 11:12 am
maxxoccupancy wrote

However, as the ship descends into the canyon, the idea is to have the canyon walls move apart in real time, to have the canyon floor grow larger to look like you're descending into it. Background tiles only draw onto a grid of 8x8, so smooth movement like that is impossible with the Grey Lancer style scrolling.

It sure would look good, though.


It could be done with specifically prepared tiles, like for example, one that is 100% floor, other that is 100% wall, and other that is 50% floor at the botom and 50% wall at the top. If you want smoother transitions, you add more transitional tiles.

Not sure if I'm passing the idea in an understandable way.
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Wed Mar 30, 2022 4:38 pm
haroldoop wrote
maxxoccupancy wrote

However, as the ship descends into the canyon, the idea is to have the canyon walls move apart in real time, to have the canyon floor grow larger to look like you're descending into it. Background tiles only draw onto a grid of 8x8, so smooth movement like that is impossible with the Grey Lancer style scrolling.

It sure would look good, though.


It could be done with specifically prepared tiles, like for example, one that is 100% floor, other that is 100% wall, and other that is 50% floor at the botom and 50% wall at the top. If you want smoother transitions, you add more transitional tiles.

Not sure if I'm passing the idea in an understandable way.


The forum is not letting me paste the link, but you can search on Google for "Smooth Scroll in XRacing"; that blog post explains what I mean better than I would be able to explain.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Fri Apr 01, 2022 5:24 am
For the canyon scene, I think that rotating and then digitizing an image like this one as an example for parallax scrolling. This strategy seems to make sense to me because different horizontal lines can be made to move independently of each other following their own formula. The highest lines of the canyon might move three pixels for every five frames while the river lines move at just one pixel per five frames.

Instead of a flat topology from the river to the plateau, each line can be given its own ratio based on its height above the river lines.

This would be similar to the effect seen in the "RASTER FX" demo above.

  View user's profile Send private message
  • Joined: 09 Aug 2021
  • Posts: 131
Reply with quote
Post Posted: Fri Apr 01, 2022 9:56 am
vertical parallax? forget.
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Fri Apr 01, 2022 10:07 am
If you rotate it 90 degrees and doctor it a bit so that there were areas with no overlap, it could actually be used in combination with horizontal raster splits.

Vertical parallax could only be achieved through tile animation, but not with tha same quality: you would need a single horizontal strip repeated over and over vertically, and then change the tiles so it looks like there's scrolling.

Yet another option would be FMV, which could be made to look good in either direction, but also would have its own set of limitations.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Fri Apr 01, 2022 1:57 pm
toxa wrote
vertical parallax? forget.


Note the actual words that I posted:
Quote
For the canyon scene, I think that rotating and then digitizing an image
  View user's profile Send private message
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Fri Apr 01, 2022 8:12 pm
Here's the same image rotated and cropped to be horizontal.

The grainier, rougher image is 256x224 (not leaving room for extra edge tiles), 256 tiles, FloydSteinberg dithering, 16 of 64 colors. IMHO, that's a good starting point. Should I start with a larger image size? Or is this fine for the effect that we're going for?

  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Fri Apr 01, 2022 8:27 pm
Nice! Now, the next step is trying to display the image on the Sega Master System:

1. You will need to resize it to 256x192 (you can use 256x244, if you want, but that resolution only works on European Master Systems);
2. Then, use RgbQuant-SMS to reduce its tile count; the VDP can use 448 tiles at maximum, but you may or may not want to reserve some of those tiles for other purposes;
3. Then, take the resulting image and convert it to 16 colors;
4. Then, you can use bmp2tile to convert it into a tileset, a background map and a palette;
5. And finally, you can try to display the image on the Sega Master System : load the tiles, load the palette, load the map.
  View user's profile Send private message Visit poster's website
  • Joined: 09 Aug 2021
  • Posts: 131
Reply with quote
Post Posted: Fri Apr 01, 2022 9:30 pm
also connection of the left and right edges...
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Fri Apr 01, 2022 10:14 pm
toxa wrote
also connection of the left and right edges...


That would be a good next step, but, for now, it would be better to concentrate on displaying the image.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Sat Apr 02, 2022 12:07 am
haroldoop wrote
Nice! Now, the next step is trying to display the image on the Sega Master System:

1. You will need to resize it to 256x192 (you can use 256x244, if you want, but that resolution only works on European Master Systems);
2. Then, use RgbQuant-SMS to reduce its tile count; the VDP can use 448 tiles at maximum, but you may or may not want to reserve some of those tiles for other purposes;
3. Then, take the resulting image and convert it to 16 colors;
4. Then, you can use bmp2tile to convert it into a tileset, a background map and a palette;
5. And finally, you can try to display the image on the Sega Master System : load the tiles, load the palette, load the map.


1. I believe that 256x224 is really the minimum needed to look good and won't need as much VBlank time with the basic game. While that won't work with SMS1, it will work with SMS, European PAL machines, and emulators, which are about 90% of the "consoles" out there.
2&3. I actually used that RgbQuant site to reduce it to 16 of 64 colors and just 256 tiles. That is literally what the background would look like pushing the SMS2 to its limits.
4. I was just going to use Pro Motion NG to convert it to tiles, but didn't know about bmp2tile. Is that the best for making SMS backgrounds?
5. Are you suggesting that I use the ROM from the green parallax scrolling scene that you included and just change the assets? This step seems like a pretty difficult step for me.
  View user's profile Send private message
  • Joined: 17 Aug 2021
  • Posts: 79
Reply with quote
Post Posted: Sat Apr 02, 2022 7:56 am
maxxoccupancy wrote
This step seems like a pretty difficult step for me.


Well this sums everything up doesn't it, before you can run with all the "tricks" you have seen you need to learn to crawl, and to crawl you need to learn z80 assembly code and learn to do the basics, print a sentence to screen, print a sprite to screen, make it movable, add collision, look at example code and so on.

I get it, you've been on Youtube and seen Jon Burton, impressive punching weight episodes and sharopolis explaining all the ways impressive visual tricks have been done on these systems. You understand broadly how they are achieved (Line Scroll, animated tiles, Look up tables), the issue is you have no idea how to program them, or the limits of the Master System and when users with far more actual coding experience point this out you don't like it.

Before ALL of these impressive visual tricks you need to learn the very basics, like how to code for the platform.

And I am sure you know this, because you know everything, so you can give a quick answer but on the photo above where exactly are you going to put the Line scroll splits to give a field of depth, usually straight lines are used with this effect for a reason.
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Sat Apr 02, 2022 10:02 am
Emrabt wrote
maxxoccupancy wrote
This step seems like a pretty difficult step for me.


Well this sums everything up doesn't it, before you can run with all the "tricks" you have seen you need to learn to crawl


Exactly; to be fair, you probably won't find anyone here willing to write the code for you (see this discussion on Atariage), but at the point it is now it's not as difficult to do as you seem to think it to be.

At least, you're progressing: on this "simple 3D canyon demo", you at least seem willing to see what is actually possible.

At this point in development, you should be able to use C with no issues; just use bmp2tile to export the maps, the palette and the tileset into binary files, and copy those binary files to RasterParallax's "assets" folder; then, when you run the included "build.bat" (you may have to rename it), it will use "assets2banks" to regenerate "bank2.c" and "bank2.h" from the contents of the "assets" folder; if you take a look at "bank2.h", you should see that the file was converted into a C constant; now, you have to edit the main file, look where the palettes, maps and tiles are loaded, and modify those to use your new assets.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Sat Apr 02, 2022 7:14 pm
Emrabt wrote
maxxoccupancy wrote
This step seems like a pretty difficult step for me.


Well this sums everything up doesn't it, before you can run with all the "tricks" you have seen you need to learn to crawl, and to crawl you need to learn z80 assembly code and learn to do the basics, print a sentence to screen, print a sprite to screen, make it movable, add collision, look at example code and so on.

I get it, you've been on Youtube and seen Jon Burton, impressive punching weight episodes and sharopolis explaining all the ways impressive visual tricks have been done on these systems. You understand broadly how they are achieved (Line Scroll, animated tiles, Look up tables), the issue is you have no idea how to program them, or the limits of the Master System and when users with far more actual coding experience point this out you don't like it.

Before ALL of these impressive visual tricks you need to learn the very basics, like how to code for the platform.

And I am sure you know this, because you know everything, so you can give a quick answer but on the photo above where exactly are you going to put the Line scroll splits to give a field of depth, usually straight lines are used with this effect for a reason.


The high level stuff I've been doing for years. I've even written performant code for embedded systems that were not much more powerful than the Z80. Obviously, my background in superscalar, dynamically scheduled processors and large, fast caching systems is not helpful in this domain, but telling people you've never met that they don't know how to handle high level 3D graphics or floating point because they are new to a particular architecture doesn't contribute to a project.

Your post doesn't offer anything new. Perhaps you would consider offering some useful information about writing or porting software.
  View user's profile Send private message
  • Joined: 17 Aug 2021
  • Posts: 79
Reply with quote
Post Posted: Sat Apr 02, 2022 7:43 pm
maxxoccupancy wrote

The high level stuff I've been doing for years. I've even written performant code for embedded systems that were not much more powerful than the Z80.


And so?
The Master System needs you to learn a much lower level code.

I can paint and decorate a house, it doesn't mean I can paint landscapes.

Quote
telling people you've never met that they don't know how to handle high level 3D graphics or floating point because they are new to a particular architecture doesn't contribute to a project.


I never said any of this. Maybe you should take your own advice above and actually start reading what is being posted?

Quote
Your post doesn't offer anything new.

your posts on the other hand are busting full of non - regurgitated information, huh, each one a golden lesson to be cherished?

Quote
Perhaps you would consider offering some useful information

I doubt you read too far into my post above but:
I asked you where you are going to put the line splits on your low resolution, software automatically color reduced canyon photo to make it work, you need areas that can be split by horizontal straight lines.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14738
  • Location: London
Reply with quote
Post Posted: Sat Apr 02, 2022 8:58 pm
I think the entertainment value of these threads is wearing off. Everyone, please just stop responding to him. I can lock the threads if this keeps going on the path it is going. Credit where it's due to those who have given him the benefit of the doubt - and also to those who have explained the flaws in his ideas.

There's material out there to get going with coding a proof of concept, especially for someone who has used a C compiler or assembler before. maxoccupancy has repeatedly explained he has the skills and knowledge so we don't need to help him with the steps. Let's wait for a result before continuing the discussion.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Mar 2022
  • Posts: 129
  • Location: Seabrook, New Hampshire
Reply with quote
Post Posted: Sun Apr 03, 2022 12:40 am
I don't think I can get the parallax scrolling added to this if I can't get help with the next few steps. I've gone over some of the documentation about the devkitSMS and SDCC work, but I'm getting mixed signals as to whether or not I can use C and still get the performance needed to get this 3D canyon demo working without dropping into Z80 Assembly and sending numbers to the VDP directly--both of which are significant tasks if one wants to go beyond the simple platform games on Homebrew.

Alternately, I can go elsewhere and use higher level tools to continue developing PC games or projects for more modern retro systems with built in 3D hardware.

All of this effort was to see if some of the techniques used in 1990s consoles without 3D hardware could also be used to create 3D effects on the SMS--probably the most powerful of the 8-bit consoles.
  View user's profile Send private message
  • Joined: 25 Feb 2006
  • Posts: 874
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Sun Apr 03, 2022 9:39 am
"RasterParallax-SMS" is mostly made in C, and it gets pretty good performance. Try not to worry too much about early optimization, which may end up being premature. You should first do a rough prototype, then make it work correctly, then make it fast.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!