How to make game work on AOS4 (Hardware DoubleBuffer)

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

How to make game work on AOS4 (Hardware DoubleBuffer)

Post by Bugala »

@Andreas, decided to put these questions here instead of email, since these might benefit others too.

For others, I sent email to Andreas as my AI Kills all Humans game was so slow on AOS4 machines, and it appears there were things I didn't know about Hollywood in AOS4 that have made the game slow.

"On OS4 you'll only get GPU
accelerated scaling if you use hardware double buffers...
..., Hollywood has
to scale the framebuffer to 1920x1080 using the CPU for every single
frame you draw which is of course a real performance killer, even
on the X5000."

"I'd recommend disabling any scaling on OS4 and just switching the
monitor resolution to the desired resolution instead."


Regarding these comes some questions:

1. As my game is intended to run on 1920x1080 screen. Does this mean that even if someone is using precisely 1920x1080 screen, but I have these:

Code: Select all

@DISPLAY {ScaleMode = #SCALEMODE_AUTO, FitScale = True, smoothscale=True
It will still not work as fast as if I would have:

Code: Select all

@DISPLAY {ScaleMode = #SCALEMODE_NONE, FitScale = false, smoothscale=false
Or does it only make difference when screensize is different than 1920x1080 in this case?

2. Can I keep switching between Regular DoubleBuffer and Hardware DoubleBuffer just like that, or is there limitations or slowdown between each switch?

For as I read, it says that Hardware DoubleBuffer is very fast for Hardware Brushes, but will be even slower than normal DoubleBuffer for drawing.

And problem is that in my game I am doing both.

My cycle would basically be following:

HARDWARE=TRUE
Display Brush showing Background
Display Brush2 which shows stuff above background, like buildings.
HARDWARE=FALSE
Draw lots of rectangles
Draw lots of Circles

Then depending what happened during this cycle, there could come some drawing to Brush or Brush2, for example if one building is destroyed from Brush 2.

Can this be done, or is there limitation in switching between Hardware and regular DoubleBuffer mode, or would it otherwise be just too slow?


3. As I mentioned in previous Cycle explanation, I have this Brush that contains the Background image. I could actually make it as a background picture instead of a brush. Would this make any difference to speed and difference to Hardware/Non Hardware mode?
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by Bugala »

Forgot to ask this one still

4. Since I am drawing lots of same sized Rectangles, would it be faster to draw these 3x3 and 8x8 sized rectangles using Draw commands in regular Double Buffer, or would it be faster to make these into Hardware Brushes and draw them in Hardware Double Buffer mode.

Or, when comparing Drawing in hardware brush mode versus displaying hardware brushes, would it be faster to display hardware brushes of these rectangles than to draw them in hardware brush mode?
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by Bugala »

And another question came to my mind.

5. If there are some restrictions on using Hollywood normally, then what if I would use RebelSDL or GL Galore plugin, would those be able to use GPU in AOS4 in some cases where regular Hollywood would have restrictions?
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by plouf »

Dont know so much in depth

However is documented that top speed in hollywood is with hardware sprites and RebelSDL plugins

Since this way is the only way to have full gpu usage and this helps a lot...

Only "drawback" is that you need gfx board but if you speak dor speed . . .dont enter AGA IN equation :-)
Christos
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by airsoftsoftwair »

I think the main problem here is that you don't have an OS4 system to test with. If you want to optimize your game for maximum performance on OS4, it's going to be very difficult if you don't have a test system to analyze and identify potential performance killers in your script. Turning off autoscaling is the first thing that should be done but it's not necessarily solving all problems. Optimizing your project for OS4 is going to be really difficult if you don't have a test system.

Also keep in mind that there are lots of different OS4 configurations. If you change everything to hardware double buffers and hardware brushes you can easily run out of memory on low-end OS4 systems like the Sam440ep which only has 64 MB of VRAM, a lot of which is already used by the OS. Thus switching to hardware brushes and double buffers will make your project less compatible because it will require lots of VRAM. It's all rather tricky but that's the fun of Amiga programming after all ;)
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by Bugala »

Right now I am only concerned on getting it to work on X5000 at least, since I didnt expect it to work on low end AOS4 systems at all.

But as I think I can try something half "blind", two core questions:

1. Game runs on 1920x1080. If someone plays it on that exact 1920x1080 screen, then is there any difference if scaling is turned on or off? Since isnt it so that it only scales if needed?

This I am asking since having Scaling on people have more options now and in future. For example the X5000 tester said that when he used 800x600 screen, the performance was okay to him, hence I wouldnt like to turn scaling off, unless it is really necessary, as I can instruct AOS4 players to use 1920x1080 if possible.

2. Switching between Hardware mode on and off, is that a problem? Since right now I can with not that much effort change to Hardware mode, but since drawing in hardware mode is slower than in regular mode, I would in practice need to switch back to regular mode in middle of a cycle.

That half the cycle would be done using Hardware mode, second part using regular.

Although:

3. Could I use rebelSDL to do both?
Bugala
Posts: 1181
Joined: Sun Feb 14, 2010 7:11 pm

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by Bugala »

@plouf

Thanks for this info. I think I will try using RebelSDL, unless Andreas says something else.
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: How to make game work on AOS4 (Hardware DoubleBuffer)

Post by airsoftsoftwair »

Bugala wrote: Sat Sep 23, 2023 8:53 am 1. Game runs on 1920x1080. If someone plays it on that exact 1920x1080 screen, then is there any difference if scaling is turned on or off? Since isnt it so that it only scales if needed?
No, if the game's default resolution is 1920x1080 then running it on 1920x1080 won't use any scaling because the resolutions are identical.
Bugala wrote: Sat Sep 23, 2023 8:53 am 2. Switching between Hardware mode on and off, is that a problem? Since right now I can with not that much effort change to Hardware mode, but since drawing in hardware mode is slower than in regular mode, I would in practice need to switch back to regular mode in middle of a cycle.
Turning hardware double buffer on and off within the main game engine doesn't seem to make much sense to me. The engine should be running either completely in hardware mode or in software mode but I don't see why you would want to switch between the two. It might make sense to use software mode for things like the intro, main menu or in-game menu or something but for the engine itself I'd stick to either software or hardware mode without switching.
Bugala wrote: Sat Sep 23, 2023 8:53 am 3. Could I use rebelSDL to do both?
Yes, RebelSDL also supports software mode but it's mostly designed for hardware mode.
Post Reply