01 May 2022, 15:30 | #1 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
Fast Red Zone and other fastmem-relocated projects
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. current status here: https://docs.google.com/spreadsheets...it?pli=1#gid=0 Last edited by jotd; 28 May 2023 at 17:26. |
01 May 2022, 17:25 | #2 |
Alien Breeder
Join Date: Dec 2007
Location: Szigetszentmiklos / Hungary
Age: 46
Posts: 1,096
|
This is really interesting. Red Zone could be the bikers' F1GP, with decent framerate.
|
01 May 2022, 18:55 | #3 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,354
|
|
01 May 2022, 19:37 | #4 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,994
|
Quote:
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 |
|
01 May 2022, 20:23 | #5 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
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 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. |
02 May 2022, 09:47 | #6 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
game now running from relocated memory. Got to test more but looks promising.
|
02 May 2022, 11:56 | #7 | |
Registered User
Join Date: Nov 2014
Location: Italy
Posts: 2,365
|
Quote:
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 |
|
02 May 2022, 13:38 | #8 |
Moderator
Join Date: Sep 2004
Location: France
Age: 50
Posts: 4,277
|
|
02 May 2022, 14:20 | #9 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
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. |
02 May 2022, 16:26 | #10 |
Registered User
Join Date: Dec 2020
Location: Italy
Posts: 1,901
|
interesting, if we can finally have a joystick controlled No Second Prize rival
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 |
02 May 2022, 17:04 | #11 |
Registered User
Join Date: Jan 2019
Location: Finland
Posts: 635
|
Red Baron. Very good simulator on DOS and Mac, but the Amiga version can only run smooth on UAE with Immediate Blitter setting enabled.
|
02 May 2022, 18:33 | #12 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,354
|
|
02 May 2022, 19:41 | #13 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
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. |
02 May 2022, 20:35 | #14 |
Moderator
Join Date: Sep 2004
Location: France
Age: 50
Posts: 4,277
|
|
02 May 2022, 21:32 | #15 | ||
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
Quote:
Red Baron already runs from fastmem with caches. Probably not a lot to optimize Quote:
|
||
02 May 2022, 21:52 | #16 |
Registered User
Join Date: Jan 2019
Location: Finland
Posts: 635
|
|
02 May 2022, 22:03 | #17 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
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. |
04 May 2022, 00:00 | #18 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
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! |
04 May 2022, 03:37 | #19 | |
Registered User
Join Date: Jan 2019
Location: Finland
Posts: 635
|
Quote:
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. |
|
04 May 2022, 09:26 | #20 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
|
ah Hunter is another candidate!
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 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 |
Proposal: Split Amiga projects and PC projects? | andreas | project.Amiga Game Factory | 4 | 12 February 2008 12:00 |
Red Zone demo on The One cover disk? | Angus | Retrogaming General Discussion | 7 | 08 November 2006 11:13 |
|
|