English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 18 August 2022, 05:47   #1
remz
Registered User
 
Join Date: May 2022
Location: Canada
Posts: 139
HAM game with sprites - Proof of concept

Hello Amiga hardware programmers!
After asking around a bunch of questions on the Copper, timing, etc., I've decided to come up with a proof-of-concept and I would like to share and get your insights of what you think about it.
The goal:
- Imagine a game that would leverage the power of the HAM mode
- Game should run on a plain unexpanded Amiga 500/1000/2000
- Using Copper to recycle sprites and change sprite colors

Here's how I would see it:
- The background, in HAM, would be made of 16x16 tiles.
- Since every tile would have their leftmost pixel always using a Palette color, no HAM fringing would occur, as long as the horizontal scrolling is done in increment of 16 pixels (i.e.: basically, jumping from one tile to another, so no smooth scrolling*)
- *Note: smooth scrolling could be possible by using a 16-pixel wide "black sprite" which would mask off the 16 leftmost pixels of the screen to hide any HAM fringing, but for now I am not considering doing that.
- The HAM color palette is composed of a simple grayscale ramp (from black to white, 16 shades)
- This palette would allow semi-realtime shadows: basically, any scanline of a tile on the screen could be tinted in realtime by subtracting a value from 0 to 15 to all its pixel values: whether that pixel represents an index-color OR a R-G-B modify value, the tinting would work by making the shade darker.
- It is almost equivalent to consider the screen a 'true-color' mode in a way.

- The sprites are set using DMA to be all enabled, position outside the visible display, and go from 0 to 255 lines (so spanning the whole screen vertically)
- Using the copper, every 16 pixels, a sprite is repositioned. So any sprite can appear anywhere on the screen, and even multiple times, per scanline. This is thanks to the fact that using 6 bitplanes, the copper has exactly just enough cycles to perform one CopMove every 16 pixels.
- During hblank, the Copper sets all of the 12 color palettes for the sprites. There is about just barely enough time to do that.
- It means that all sprites are composed of many colors. See the attached screenshot to view my current test sprite sheet.

The 3rd screenshot is running in WinUAE:
In total currently this proof of concept is showcasing:
- a background with 1243 colors (in HAM)
- 320 simultaneous sprites on the screen, using a total of 533 colors

(Technically the maximum possible would be 4096 colors for the background, and 3072 colors for the sprites).
During the screen display, the CPU is pretty much completely starved by display DMA and copper, so only the Vblank period would be usable for game logic, scrolling, blitter, etc.

What do you think of my idea? I'm eager to hear from you amiga experts!
(I've added a screenshot of the DMA debugger to show the screen is packed; I do not know what the colors mean however since I never used that WinUAE feature before)

Thank you,
Rem
Attached Thumbnails
Click image for larger version

Name:	mockup_tile_320x256_output.png
Views:	360
Size:	23.1 KB
ID:	76349   Click image for larger version

Name:	sprite_mock_combined_dyncol.png
Views:	302
Size:	17.1 KB
ID:	76350   Click image for larger version

Name:	rogue_amiga500_screenshot.png
Views:	381
Size:	107.8 KB
ID:	76351   Click image for larger version

Name:	rogue_amiga500_screenshot_dma.png
Views:	311
Size:	92.1 KB
ID:	76352  
remz is offline  
Old 18 August 2022, 10:31   #2
khph_re
Registered User
 
Join Date: Feb 2008
Location: Northampton/UK
Posts: 525
There are a couple of HAM games out there, Pioneer Plague is one of them,
most are slower paced RPG style affairs.
The demo HAM Eager by Platon really shows HAM strutting it's stuff.
I guess there are not so many HAM games as it is technically challenging, and rather slow.

Looking forward to seeing what you achieve, looking great so far!
khph_re is offline  
Old 18 August 2022, 15:36   #3
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
Very interesting stuff, thanks for making this proof of concept. I've always wondered how you could do a HAM game with more flexibility than what Pioneer Plague is doing, so this is nice to see

I do wonder a little bit about the Sprite multiplexing you suggest.
How do you see this working with freely moving Sprites?

At a guess, I'd say that this would require not just Sprite repositioning, but also reloading the Sprite data. If you also need per-pixel movement horizontally, that would mean doing 4 Copper moves per Sprite channel reloaded/positioned, or 64 pixels worth of 'space' between each reloaded Sprite channel given that each Copper move takes 16 pixels. Makes me wonder how easy/hard that would get with multiple freely moving objects on the screen.

As for the Visual DMA debugger of WinUAE, it's a great tool to see the use of the various DMA sources and the CPU in Chip RAM. Each 'pixel' in the Visual Debugger represents a DMA cycle in Chip RAM and the colours each represent a DMA or CPU source.

Here's a small list of colours used:
Magenta = Sprites
Yellow/Dark yellow = Copper
Red = audio
Dark Red & Gray = CPU (read/write)
Dark gray = memory refresh
Cyan/Green/Light blue-green = Blitter
Blue = Bitplanes
White = Disk

Last edited by roondar; 18 August 2022 at 15:44. Reason: Corrected the colour listing for the current versions of WinUAE
roondar is offline  
Old 18 August 2022, 16:07   #4
Jobbo
Registered User
 
Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 389
I really like this! Love to see a novel approach!

I especially like the idea of using three color sprites but changing their palette every line. You see that a lot for backgrounds but I don't think I've seen it used for sprites so effectively.

You might consider scaling back your ambitions for the sprites and only multiplexing them vertically. That would still allow for 8 sprites on a line and would free up more DMA slots for the CPU or blitter to use. That might be more practical for a real game system.

With 6 planes for the screen and tiles you'll likely run into memory constraints on an OCS A500 so you might want to plan on the background remaining single buffered and arranging blits so they race the beam.

Anyway, great stuff!
Jobbo is offline  
Old 18 August 2022, 16:09   #5
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
Yeah, using only 8 sprites per line would make this a whole lot easier for sure
roondar is offline  
Old 18 August 2022, 16:50   #6
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,884
Really interesting concept as well as nice and cute gfx.
Hope to see some animated gif or video soon.
malko is offline  
Old 18 August 2022, 22:39   #7
remz
Registered User
 
Join Date: May 2022
Location: Canada
Posts: 139
Quote:
Originally Posted by roondar View Post
I do wonder a little bit about the Sprite multiplexing you suggest.
How do you see this working with freely moving Sprites?
Yes the "rogue-like / dungeon crawler" type of game I have in mind would be pretty much tile-based, 16x16, so I was hoping to not require moving sprites smoothly across the tile. They would basically 'jump' from tile to tile, a bit like Crypt of the Necrodancer: [ Show youtube player ]

Also you are correct, normally in a dungeon there would never be 320 objects on the screen at the same time, so there would be some spare cycles for allowing two objects on the same tile (for example, the Hero jumping on a Coin to collect it, or the Hero walking past a Torch hanging on the wall).

I also wanted to have door archways that the Hero can walk underneath, so sprite numbering for priorities would also be considered carefully.

Next step I'll attempt to implement basic character movement and more realistic sprite multiplexing to see how feasible it could be. And then provide an ADF disk file here so in can be tested on various configs.

About memory: I was intending to use a single buffer for the HAM display 48KB, and possibly a single copper list (if possible) to save on memory. The copper list is quite big at about 17KB. Plus 8KB of sprite DMA data.
So figuring out maybe 48KB of tile graphic data, and 32KB of sprites data (so total of around 153KB out of 512KB). Some space needs to be available for music and sounds, that part I haven't looked at all so far.

For horizontal scrolling, I was thinking of simply moving the starting address of the bitmap by 16 pixels (2 words), so only one tile column needs to be drawn at the right edge.
For vertical scrolling, it would be resetting the address of the bitmap at the appropriate point.
(I haven't completely investigated how scrolling would be done, but I was heading toward scrolling only by 16x16 tile increment)
remz is offline  
Old 18 August 2022, 22:58   #8
Pyromania
Moderator
 
Pyromania's Avatar
 
Join Date: Jan 2002
Location: Chicago, IL
Posts: 3,375
Interesting concept, why not use AGA HAM8?
Pyromania is offline  
Old 19 August 2022, 05:58   #9
remz
Registered User
 
Join Date: May 2022
Location: Canada
Posts: 139
Quote:
Originally Posted by Pyromania View Post
Interesting concept, why not use AGA HAM8?
It would be a different challenge and surely interesting too.
But I wish to have something that would work on unexpanded original trio 500/1000/2000 models.
remz is offline  
Old 19 August 2022, 10:57   #10
stevelord
Registered User
 
stevelord's Avatar
 
Join Date: Apr 2019
Location: UK
Posts: 540
This is going to sound weird, but I think this look would also work really well for a sokoban-type game. It'd also let you play with the game mechanics a bit without having to push too hard (no pun intended).

For an RPG this looks amazing and I would love to try it. I'd be a little concerned the RPG scope might be a bit too big to build, fit into an A500 and get out of the gate depending on how much time you have for it. Would you be interested in maybe trying something smaller first to get a basic full game working then expanding?

I really love the approach though. The 16x16 tile model works far better than I ever thought it might.

We definitely need more OCS/ECS HAM games. I've been playing LINKS lately and I'm surprised there are so few HAM games out there.
stevelord is offline  
Old 19 August 2022, 11:07   #11
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
Quote:
Originally Posted by remz View Post
Yes the "rogue-like / dungeon crawler" type of game I have in mind would be pretty much tile-based, 16x16, so I was hoping to not require moving sprites smoothly across the tile. They would basically 'jump' from tile to tile, a bit like Crypt of the Necrodancer: [ Show youtube player ]
This is a very neat idea, really. If the movement is more jump-like and really only from tile to tile, it doesn't matter nearly as much as when it needs to be freely moving everywhere. Makes me think something like this should definitely be possible.

Cool stuff
Quote:
Next step I'll attempt to implement basic character movement and more realistic sprite multiplexing to see how feasible it could be. And then provide an ADF disk file here so in can be tested on various configs.
Looking forward to it
Quote:
About memory: I was intending to use a single buffer for the HAM display 48KB, and possibly a single copper list (if possible) to save on memory. The copper list is quite big at about 17KB. Plus 8KB of sprite DMA data.
So figuring out maybe 48KB of tile graphic data, and 32KB of sprites data (so total of around 153KB out of 512KB). Some space needs to be available for music and sounds, that part I haven't looked at all so far.
If you can get away with single buffering the screen that would be a very good way to limit memory use. Single Copper list might get tricky, I've not had good experiences updating Copper lists in real time unless I timed that carefully, made it all fit in the vertical blank area or used a double buffered Copper list.
roondar is offline  
Old 19 August 2022, 13:10   #12
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,064
Bill Williams Knights of the Crystallion was HAM only and did run on a Standard A500.

https://hol.abime.net/2597

and also Pioneer Plague

https://hol.abime.net/1068

But i guess you already knew those

Last edited by Torti-the-Smurf; 19 August 2022 at 18:06. Reason: adding Links to HOL
Torti-the-Smurf is offline  
Old 19 August 2022, 15:37   #13
khph_re
Registered User
 
Join Date: Feb 2008
Location: Northampton/UK
Posts: 525
I often wondered If Heroes of Might and Magic: Clash of Heroes could be done in such a HAM format, with AGA+ resembling (vaguely) the big boy version in 640x512, and OCS looking like the DS one in 320x256.

360/PS3/Android (Quick resize to 640x512)


Nintendo DS
khph_re is offline  
Old 19 August 2022, 16:39   #14
Pyromania
Moderator
 
Pyromania's Avatar
 
Join Date: Jan 2002
Location: Chicago, IL
Posts: 3,375
I would love to see a HAM8 platform game for some strange reason.
Pyromania is offline  
Old 19 August 2022, 17:00   #15
rothers
Registered User
 
Join Date: Apr 2018
Location: UK
Posts: 487
Quote:
Originally Posted by Pyromania View Post
I would love to see a HAM8 platform game for some strange reason.

I think a slightly scrolling one could be possible if it was laid out right.



Or maybe something along the lines of bubble bobble is more feasible.


That sprite multiplexer would have to be top notch.
rothers is offline  
Old 19 August 2022, 18:33   #16
Pyromania
Moderator
 
Pyromania's Avatar
 
Join Date: Jan 2002
Location: Chicago, IL
Posts: 3,375
We need more HAM games. Only Bill Williams created a couple of them years ago. He was a very talented developer that was lost unfortunately. It would be exciting for more HAM games to be developed. The Amiga has those unique and interesting features like HAM for example that give it character.
Pyromania is offline  
Old 19 August 2022, 19:36   #17
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,894
Quote:
Originally Posted by Pyromania View Post
We need more HAM games. Only Bill Williams created a couple of them years ago. He was a very talented developer that was lost unfortunately. It would be exciting for more HAM games to be developed. The Amiga has those unique and interesting features like HAM for example that give it character.
Be careful what you wish for...

[ Show youtube player ]
Havie is offline  
Old 19 August 2022, 19:43   #18
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,606
Quote:
Originally Posted by Havie View Post
Be careful what you wish for...

[ Show youtube player ]
Or: http://hol.abime.net/4968/screenshot
TCD is offline  
Old 19 August 2022, 21:07   #19
rothers
Registered User
 
Join Date: Apr 2018
Location: UK
Posts: 487
Does the nighmare fest that is top banana use HAM mode? Some of the later levels are pushing some really weird colour depths. Or is it just hammering the blitter in 32/64 colour mode? It's an odd one.

[ Show youtube player ]
rothers is offline  
Old 20 August 2022, 00:40   #20
DisasterIncarna
Registered User
 
DisasterIncarna's Avatar
 
Join Date: Oct 2021
Location: England
Posts: 1,180
if stuff not moving around too much or at all is a requirement, then maybe imitating something like the Valhalla adventure games?
DisasterIncarna is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proof of concept: Network bootdisk and installer for real hardware Firestone Amiga scene 12 17 July 2021 15:02
Hang On proof of concept skyzoo73 Amiga scene 25 21 February 2020 22:33
Please Help me find this HAM game Gilbert Amiga scene 9 05 April 2014 11:07
Amikill Amiga Concept Doom Weapons Game Amiten project.Amiga Game Factory 6 04 March 2013 18:18
Game that used 'HAM' mode Big-Byte Looking for a game name ? 24 28 August 2002 10:37

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:47.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10540 seconds with 14 queries