English Amiga Board


Go Back   English Amiga Board > Other Projects > project.Amiga Game Factory

 
 
Thread Tools
Old 01 May 2022, 15:30   #1
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
Fast Red Zone

Anyone remembers the infamous Red Zone by Psygnosis?

Good graphics good sound good intro and awful frame rate? Probably too ambitious on a 68000.

Well, for 17+ years I've been trying to speed that game up for high end amigas, even if I don't particularly like the genre, I always thought that that was a shame that the game had such a low FPS (and Angus repeatedly wanted to bump this subject too)

After analysis, game doesn't use blitter (can be handy but not necessarily for a 3D game) and a lot of self-modifying code (to speed game up probably on a 68000, but it failed)

Fun fact: game is very smooth on WinUAE, probably because winuae doesn't care about chipmem latency when code is running in chip. But it's dead slow on my A1200/060.

Biggest problem: game runs in chipmem. Well, just relocate it in fastmem, well easier said than done because the "executable" isn't one, it's just a block of code assembled at a fixed location.

Ok, then disassemble it, reassemble it somewhere else and you're good... Yes, but no, as the game uses a lot of tables, containing addresses...

For years I've tried to relocate the original code in fastmem by detecting the reloc offsets in the exe using various scripts. It worked to some extent, but I always seemed to miss something... Well now, I' ve changed my strategy.

I decided to try to reassemble the game to an executable file, and then track all read/writes to the original chipmem area (using Winuae) until the 3D section shows up (my old strategy was just to copy the exe in fast, but leave it in chip too just in case the game reads from chip, which was a big mistake as it didn't track down all hidden address tables...)

Today after 1 week of hard work, various python scripts (some pretty intricate), it showed up I didn't have the opportunity to test on real hardware but I'll do in the week.

I'm sure it will be slightly faster, but maybe now that the "source" is assembleable, I can start to hack into it. I suspect that the EORing/ORing and ANDing direclty in chipmem is also darn slow compared to doing that on a backbuffer in fastmem and just copy the whole planes afterwards.

I'll keep you posted on the project.
jotd is offline  
Old 01 May 2022, 17:25   #2
Reynolds
Alien Breeder
Reynolds's Avatar
 
Join Date: Dec 2007
Location: Szigetszentmiklos / Hungary
Age: 44
Posts: 615
This is really interesting. Red Zone could be the bikers' F1GP, with decent framerate.
Reynolds is offline  
Old 01 May 2022, 18:55   #3
alexh
Thalion Webshrine
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 12,996
Quote:
Originally Posted by Reynolds View Post
This is really interesting. Red Zone could be the bikers' F1GP, with decent framerate.
That would be No Second Prize wouldn't it?
alexh is offline  
Old 01 May 2022, 19:37   #4
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 48
Posts: 8,396
Quote:
Originally Posted by jotd View Post
Anyone remembers the infamous Red Zone by Psygnosis?

Good graphics good sound good intro and awful frame rate? Probably too ambitious on a 68000.

Well, for 17+ years I've been trying to speed that game up for high end amigas, even if I don't particularly like the genre, I always thought that that was a shame that the game had such a low FPS (and Angus repeatedly wanted to bump this subject too)

After analysis, game doesn't use blitter (can be handy but not necessarily for a 3D game) and a lot of self-modifying code (to speed game up probably on a 68000, but it failed)

Fun fact: game is very smooth on WinUAE, probably because winuae doesn't care about chipmem latency when code is running in chip. But it's dead slow on my A1200/060.

Biggest problem: game runs in chipmem. Well, just relocate it in fastmem, well easier said than done because the "executable" isn't one, it's just a block of code assembled at a fixed location.

Ok, then disassemble it, reassemble it somewhere else and you're good... Yes, but no, as the game uses a lot of tables, containing addresses...

For years I've tried to relocate the original code in fastmem by detecting the reloc offsets in the exe using various scripts. It worked to some extent, but I always seemed to miss something... Well now, I' ve changed my strategy.

I decided to try to reassemble the game to an executable file, and then track all read/writes to the original chipmem area (using Winuae) until the 3D section shows up (my old strategy was just to copy the exe in fast, but leave it in chip too just in case the game reads from chip, which was a big mistake as it didn't track down all hidden address tables...)

Today after 1 week of hard work, various python scripts (some pretty intricate), it showed up I didn't have the opportunity to test on real hardware but I'll do in the week.

I'm sure it will be slightly faster, but maybe now that the "source" is assembleable, I can start to hack into it. I suspect that the EORing/ORing and ANDing direclty in chipmem is also darn slow compared to doing that on a backbuffer in fastmem and just copy the whole planes afterwards.

I'll keep you posted on the project.
Sounds super complicated way of achieving what I did for Stun Runner.

I didn't use complicated scripts and stuff, I firstly search for all absolute JSR's and JMP's.

Then I searched for all LEA's that were absolute, ignored obvious stuff like $dff000 and $bfe001.

I then searched for typical instructions used for calling routines in tables, and then processed those by hand.

I was probably luckier than you in that I had no self modifying code to deal with, but that brought about results right away for me.

But well done, its nice to see attempts to make what was a crap game actually something worth playing, because it was obvious that the engine underlying Red Zone was very good, i'm just stunned they locked it to 68000 so much when the benefits of it running quicker on faster processors would have given it the gameplay boost it needed.

Team Suzuki suffers the same fate as well.

In both cases, a good game is struggling to get released from the confines of 68000
Galahad/FLT is offline  
Old 01 May 2022, 20:23   #5
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
It was slightly more complex in Red Zone yes

For instance, the main draw table consisted of blocks like: a routine (reloc needed), plus parameters that depended of the routine and which could be word, long or pointer... I had to use a python script to decode all that crap and generate proper tables.

Code:
lb_fa94:
	dc.l	lb_e1f8	;0fa94
	dc.w	$0002	;0fa98
	dc.w	$0004	;0fa9a
	dc.w	$0006	;0fa9c
	dc.w	$0008	;0fa9e
	dc.w	$ffff	;0faa0
lb_faa2:
	dc.l	lb_dde0	;0faa2
	dc.w	$0006	;0faa6
	dc.w	$20ca	;0faa8
	dc.w	$0004	;0faaa
	dc.w	$0002	;0faac
	dc.w	$0008	;0faae
	dc.w	$0006	;0fab0
	dc.w	$ffff	;0fab2
	dc.l	$ffffffff	;0fab4
lb_fab8:
	dc.l	lb_d458	;0fab8
	dc.w	$012c	;0fabc
lb_fabe:
	dc.l	lb_e496	;0fabe
lb_fac2:
	dc.l	lb_4d64a	;0fac2
lb_fac6:
	dc.l	lb_4d64c	;0fac6
lb_faca:
	dc.l	lb_4d64e	;0faca
	dc.w	$0000	;0face
Note: the table is 32k in size!!! good luck doing that by hand.

Plus the coders were really inconsistent in their coding, using either movea.l #address,another_address or lea address,A0 (depending on the mood?). LEAs are translated to labels, but moveas could very well be data...

The trick was to use winuae and read/write watchpoint on the whole program (previous location) and work from there to be sure not to miss anything.

It's not over yet, but looking good.
jotd is offline  
Old 02 May 2022, 09:47   #6
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
game now running from relocated memory. Got to test more but looks promising.
jotd is offline  
Old 02 May 2022, 11:56   #7
Seiya
Registered User

Seiya's Avatar
 
Join Date: Nov 2014
Location: Italy
Posts: 1,398
Quote:
Originally Posted by jotd View Post
Anyone remembers the infamous Red Zone by Psygnosis?

Fun fact: game is very smooth on WinUAE, probably because winuae doesn't care about chipmem latency when code is running in chip. But it's dead slow on my A1200/060.

I tried on WinUAE and in emulation A500 is jerky, impossibile to drive with that frame rate.
on stock A1200 WinUAE config is better, surely not smoother, but the gameplay is better.
Your problem is that you have 68060 that is very bad on old 3D games as they don't support such processor, totally risc in integer and floating point instructions.
For curiosity i tried to launch the game with 68060 config, but the game crash at boot because 68060 require 68060.library loaded before launching the game. Of course with boot disk you cannot do it
Seiya is offline  
Old 02 May 2022, 13:38   #8
CFou!
Moderator
CFou!'s Avatar
 
Join Date: Sep 2004
Location: France
Age: 49
Posts: 3,529
Quote:
Originally Posted by jotd View Post
Anyone remembers the infamous Red Zone by Psygnosis?

Good graphics good sound good intro and awful frame rate? Probably too ambitious on a 68000.
in style, No Second Prize is pretty good. but probably fewer objects to manage...
CFou! is offline  
Old 02 May 2022, 14:20   #9
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
I don't think it's a 68060 instruction issue. Got to check that but it's more like 3D cpu intensive (and non FPU) executing in chipmem. Also no blitter to fill surfaces. Everything is done 100% with the CPU. Accelerators hate that setting.

I'll check my version on my A1200/060 this week. I hope the speed is good. So many hours spent trying to make that game work...

If you know of other 3D games that could be sped up, please mention them (not TFX). If game runs in chipmem, relocating it could do the trick.
jotd is offline  
Old 02 May 2022, 16:26   #10
kremiso
Registered User
 
Join Date: Dec 2020
Location: Italy
Posts: 615
interesting, if we can finally have a joystick controlled No Second Prize rival

Quote:
Originally Posted by Galahad/FLT View Post
...Team Suzuki suffers the same fate as well
i prefer the training disk than the final release of that one
the controls are much more responsive, and the game itself little smooth
strangely better, not just easier imo
kremiso is offline  
Old 02 May 2022, 17:04   #11
Aardvark
Registered User

 
Join Date: Jan 2019
Location: Finland
Posts: 228
Quote:
Originally Posted by jotd View Post
If you know of other 3D games that could be sped up, please mention them (not TFX). If game runs in chipmem, relocating it could do the trick.
Red Baron. Very good simulator on DOS and Mac, but the Amiga version can only run smooth on UAE with Immediate Blitter setting enabled.
Aardvark is offline  
Old 02 May 2022, 18:33   #12
alexh
Thalion Webshrine
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 12,996
Quote:
Originally Posted by CFou! View Post
No Second Prize is pretty good. but probably fewer objects to manage...
I'm not sure that's true? The NSP 3D engine by Chris Jungen was widely considered to be the fastest at the time.
alexh is offline  
Old 02 May 2022, 19:41   #13
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 49
Posts: 4,529
There is another possibility to properly resource code at absolute location.
Try to find a different version of same program. As soon as code size changes, all subsequent addresses also change and you can get some reloc table out of this. I used this trick for Back to the Golden Age.
meynaf is offline  
Old 02 May 2022, 20:35   #14
CFou!
Moderator
CFou!'s Avatar
 
Join Date: Sep 2004
Location: France
Age: 49
Posts: 3,529
Quote:
Originally Posted by alexh View Post
I'm not sure that's true? The NSP 3D engine by Chris Jungen was widely considered to be the fastest at the time.
I wrote 'probably'
because I never played Red Zone. On the other hand, I played the excellent NSP a lot!
CFou! is offline  
Old 02 May 2022, 21:32   #15
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
Quote:
Originally Posted by Aardvark View Post
Red Baron. Very good simulator on DOS and Mac, but the Amiga version can only run smooth on UAE with Immediate Blitter setting enabled.

Red Baron already runs from fastmem with caches. Probably not a lot to optimize

Quote:
There is another possibility to properly resource code at absolute location.
Try to find a different version of same program. As soon as code size changes, all subsequent addresses also change and you can get some reloc table out of this. I used this trick for Back to the Golden Age.
There isn't any other version of this game. I used that trick when game (I don't remember which one) is pre-relocated at $80000 and $C0000 depending on the memory layout. They were so lazy they prefered including 2 copies of the program instead of a proper reloc system.
jotd is offline  
Old 02 May 2022, 21:52   #16
Aardvark
Registered User

 
Join Date: Jan 2019
Location: Finland
Posts: 228
Quote:
Originally Posted by jotd View Post
Red Baron already runs from fastmem with caches. Probably not a lot to optimize
Wonder why it's so slow then on TF1260 at 100mhz. The Mac version via Shapeshifter is much faster and that one runs on 256 color interlaced hires mode.
Aardvark is offline  
Old 02 May 2022, 22:03   #17
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
The program (Red Baron) seems to call graphics OwnBlitter/DisownBlitter a lot. Maybe it's stupid and slow to do that all the time...

Removing them doesn't change a thing. But for me the game runs smoothly already.

Last edited by jotd; 04 May 2022 at 00:01.
jotd is offline  
Old 04 May 2022, 00:00   #18
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
Could check the fast relocated version of Red Zone on my 1200/060 and the framerate is MUCH better. It's even good I think I get 20 fps instead of lame 10 fps I have with original.

There are graphical issues that I'm investigating (wrong polygon drawing, probably my mistake) but it really looks good!
jotd is offline  
Old 04 May 2022, 03:37   #19
Aardvark
Registered User

 
Join Date: Jan 2019
Location: Finland
Posts: 228
Quote:
Originally Posted by jotd View Post
The program (Red Baron) seems to call graphics OwnBlitter/DisownBlitter a lot. Maybe it's stupid and slow to do that all the time...

Removing them doesn't change a thing. But for me the game runs smoothly already.
Runs quite poorly on my 060, especially compared to the Mac version on the same machine. [ Show youtube player ]

Hunter is another game which has really fast 3D on WinUAE when disabling Cycle-exact, but doesn't benefit from faster CPU's on real machines.
Aardvark is offline  
Old 04 May 2022, 09:26   #20
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 50
Posts: 6,285
ah Hunter is another candidate!
jotd is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
at a loss with Red Zone framerate jotd project.WHDLoad 23 02 March 2021 19:55
Cover Disk: Red Zone demo - Freezeframe? Angus support.Games 10 06 May 2020 16:09
Red Zone? mikey2002kent support.Games 0 26 February 2014 22:06
Use of 4MB PCMCIA Fast Flash Memory as Fast RAM in A1200 nkarytia support.Hardware 10 16 September 2011 13:37
Red Zone demo on The One cover disk? Angus Retrogaming General Discussion 7 08 November 2006 11:13

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 09:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Page generated in 0.09771 seconds with 16 queries