Author |
Message |
- Joined: 01 Feb 2014
- Posts: 878
|
My first try at programming the SMS
Posted: Fri Mar 14, 2014 6:25 pm
|
Long time lurker, first time poster here. The Sega Master System is my favourite Console ever since my parents got me one for Christmas 1987 instead of the Atari 2600 that was actually on my wishlist (thanks, Mum and Dad).
I haven't written a line of code since learning Turbo Pascal in school some 20 years ago, though. So I thoroughly read through Maxim's tutorial (thanks for that) and, additionally, got two books off the Amazon Marketplace ("How to program the Z80" and "Z80 Assembly Language Programming") and went to work.
It would possibly have been smarter to start with a variation on "Hello World", but nevertheless, I'm actually pretty pleased with how my first program turned out (screenshot attached). The learning curve was pretty steep, but in the end I made the emulated SMS display my background graphics on the screen and move around an animated sprite.
The movement of the player sprite (which consists of 5 to 6 tiles, depending on the animation frame) seems a little jerky, though. I guess that's because I don't use a buffer copy of the sprite table in RAM and writing directly to the VDP is too slow for smooth movement.
I definitely have a lot to learn still, but so far it's really fun.
|
|
|
- Joined: 06 Apr 2011
- Posts: 250
- Location: Netherlands
|
Posted: Fri Mar 14, 2014 6:56 pm
|
Look promising.
Nice graphics. Did you make them yourself?
|
|
|
- Joined: 17 Sep 2013
- Posts: 140
- Location: TC, MI
|
Posted: Fri Mar 14, 2014 8:14 pm
|
First program my butt! That is gorgeous!
|
|
|
- Joined: 21 Jul 2005
- Posts: 412
- Location: GBG
|
Posted: Fri Mar 14, 2014 8:41 pm
|
Really nice remake of the graphics from Bruce Lee) =)
|
|
|
- Site Admin
- Joined: 19 Oct 1999
- Posts: 14745
- Location: London
|
Posted: Fri Mar 14, 2014 8:44 pm
|
If you're updating six sprites, there should be plenty of time in the VBlank. However, blasting a copy of the sprite table from RAM to VRAM is more common.
It's also the case for most games that they store the main sprite graphics uncompressed in ROM, and instead of updating the tile indices for animation, write into the tiles themselves for each frame. That's a lot more data, but it allows you to have many more frames of animation. You still have to update the sprite coordinates, of course.
|
|
|
- Joined: 08 Dec 2013
- Posts: 200
|
Posted: Fri Mar 14, 2014 10:55 pm
|
This is what Sonic 1 does. Because the spirte only uses the first 8 colours the third byte of a tile row will always be 0, so this is excluded from the data to compress it ever so slightly.
|
|
|
- Site Admin
- Joined: 08 Jul 2001
- Posts: 8652
- Location: Paris, France
|
Posted: Fri Mar 14, 2014 11:38 pm
|
The art is beautiful.
|
|
|
- Joined: 01 Feb 2014
- Posts: 878
|
Posted: Sat Mar 15, 2014 9:58 am
|
Maxim wrote If you're updating six sprites, there should be plenty of time in the VBlank. However, blasting a copy of the sprite table from RAM to VRAM is more common.
It's also the case for most games that they store the main sprite graphics uncompressed in ROM, and instead of updating the tile indices for animation, write into the tiles themselves for each frame. That's a lot more data, but it allows you to have many more frames of animation. You still have to update the sprite coordinates, of course.
That's what I'm doing, actually. I figured that if I wanted to have three objects with up to six tiles each on screen at the same time, I'd have to treat two of them this way, because otherwise it would be impossible to store all the frames of animation. Each walking cycle alone has six frames.
Anyway, I found out what caused the jerkiness. It was actually me accidently tying the sprite table writes to the animation frames updates. So the movement was calculated correctly all along, but it was only displayed whenever I loaded a new animation frame. A silly mistake, really.
I got the sprites moving and animating smoothly now. When I change direction, though, there's occasionally a single frame where I've got the old tiles in the new spots. I think I'll have to check again which stuff is updated in which order.
Zipper wrote Nice graphics. Did you make them yourself?
FluBBa wrote Really nice remake of the graphics from Bruce Lee) =)
Bock wrote The art is beautiful.
Thanks a lot.
Yes, I did make the graphics myself. Other than with assembly language I do have some experience here, though. In fact, a couple of years ago I did pixel art for a living. (Google "Gem Jam Fever" and you'll find screenshots of a voodoo-themed Columns clone for cellphones I have worked on.)
Working with the Master System's palette is not easy, as it contains many colours that are very similar to each other and it's tough to create a coherent atmosphere and not end up with too many garish colours on screen. If you apply a little colour psychology, though, you can do some neat stuff with putting logically "wrong" colours in the right places (like the purple on the mountain tops or the green edges on the bull-pig-statue thing).
Of course working within limitations is always a fun challenge. :-)
The screen layout is actually based on the Spectrum version of Bruce Lee, which I chose because it has the same screen resolution as the Master System and, well, I like the game and its madcap setting.
By the way, if someone's project is an artist short, I might be willing to help out, provided the project interests me and I have the spare time needed to do it. Just ask.
|
|
|
- Joined: 16 May 2002
- Posts: 1356
- Location: italy
|
Posted: Sat Mar 15, 2014 12:01 pm
|
The art looks very good indeed!
|
|
|
- Joined: 31 Oct 2007
- Posts: 853
- Location: Estonia, Rapla city
|
Posted: Sun Mar 16, 2014 2:05 pm
|
Whoa, that screenshot is absolutely beautiful !
|
|
|
Revo
|
Posted: Sun Mar 16, 2014 7:21 pm
|
Really nice job Kagesan.
Are you submiting the game for the competition end of the month?
Cheers.
|
|
|
- Joined: 05 Sep 2013
- Posts: 3828
- Location: Stockholm, Sweden
|
Posted: Sun Mar 16, 2014 10:50 pm
|
Looks very nice!
If you need music and SFX in the game you could try my PSGlib, of course I will give you support :)
|
|
|
- Joined: 25 Feb 2006
- Posts: 874
- Location: Belo Horizonte, MG, Brazil
|
Posted: Sun Mar 16, 2014 11:35 pm
|
Looking good, so far. Can't wait to see it in action! ;)
|
|
|
- Joined: 01 Feb 2014
- Posts: 878
|
Posted: Mon Mar 17, 2014 5:49 pm
|
Revo wrote Are you submiting the game for the competition end of the month?
I don't know. Maybe if I get the basic moves set of the player sprite or at the very least the logic map fully up and running before the deadline. As of yet, I don't really feel my contribution is up to scratch.
sverx wrote If you need music and SFX in the game you could try my PSGlib, of course I will give you support :)
I have actually followed the development of your PSGlib very closely, and I think you've done some awesome work there. I'm still far from adding sound to my "game", but when it comes to that, it's very likely that I'm going to want to use PSGlib.
However, with the help of mod2psg I do have already composed a short track I plan to use as an ingame tune somewhere along the line. Maybe I'll submit that one for the music competition.
|
|
|
- Joined: 05 Sep 2013
- Posts: 3828
- Location: Stockholm, Sweden
|
Posted: Tue Mar 18, 2014 8:45 am
|
Kagesan wrote I have actually followed the development of your PSGlib very closely, and I think you've done some awesome work there.
Yeah, if only I could make it work ;D
|
|
|
- Joined: 11 Mar 2014
- Posts: 91
- Location: France
|
Posted: Tue Mar 18, 2014 6:38 pm
|
Kagesan wrote
The screen layout is actually based on the Spectrum version of Bruce Lee, which I chose because it has the same screen resolution as the Master System and, well, I like the game and its madcap setting.
I just wanted to say that I love your artstyle and I really hope you can complete this game. The SMS needs more Bruce Lee!
|
|
|