Reburn 3: Development Blog

A place to discuss reverse engineering and modding Burnout 3: Takedown.
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

TheGoat62 wrote: Wed Apr 12, 2023 10:41 am I also noticed that the fog and lens flare are also absent which could connect to the reason why the environment is darker because it has something to do with the push buffer.
Yeah I think it's safe to assume those are push buffer-based too and will require rewriting to port over. I wonder if there's any particular reason a lot of these ancillary effects got inlined like this over other stuff.
TheGoat62 wrote: Wed Apr 12, 2023 10:41 am Also why is the game overscanning?
That seems to be an artifact of the function I nopped to get the 3D to appear. You can see some stuck image data there in the loading screen at the start too. I don't yet know why, but I'm guessing it was responsible for clearing and setting up those areas?
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

MattKC wrote: Wed Apr 12, 2023 10:41 am I think I might start working on my custom launcher (which will patch the game on the fly before running it through Cxbx) so people can start playing with it themselves.
oh yes please :)

i wonder how Crash works since well, you crash in it. Does it react the same (crashes the game) or something else occurs?
KEKW Goin' Flipmode!
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

CrabHead wrote: Wed Apr 12, 2023 2:36 pm i wonder how Crash works since well, you crash in it. Does it react the same (crashes the game) or something else occurs?
Just tested and yep, it just crashes when you crash again.

It's probably an easy fix, let me try to investigate that more...
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

Okay fixed the crashing. It was, as always, more push buffer shenanigans. I've nopped it for now, and since I haven't encountered any other crashes yet, I think the game is pretty stable now.

Here's some footage of Crash mode now that it works (ignore no audio until 0:04, that's a recording issue not a game issue):


Interesting things to note:
  • Items only appear as "shadows" (e.g. bonuses, instant boost).
  • Ramp doesn't appear.
  • Unusual pause on first impact (around 0:25). Could be coincidental, or could be related to that "crash crash" I just addressed?
Once again, all of these are likely push buffers failures again, so I think it's officially time to start digging into those and rewriting them. That being said, I will write a launcher first, not just so testing becomes easier, but also because it'll give me the injection framework to rewrite functions more easily.
User avatar
DrScoop
Posts: 7
Joined: Tue Mar 28, 2023 1:04 am

Re: Development Blog

Post by DrScoop »

Will you be providing this for anyone to play (who has a B3 ISO acquired legitimately ;) ) after you have the launcher written up?
User avatar
TheGoat62
Posts: 16
Joined: Thu Jan 26, 2023 4:38 am

Re: Development Blog

Post by TheGoat62 »

I noticed from the video that the car doesn't make any sounds (except for the gear shift) like it turned into an electric car. Is this a bug from the original game or was it caused by nopping some of the functions you said?
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

TheGoat62 wrote: Thu Apr 13, 2023 9:37 am I noticed from the video that the car doesn't make any sounds (except for the gear shift) like it turned into an electric car. Is this a bug from the original game or was it caused by nopping some of the functions you said?
im 99% sure that is a cause from nopping the functions
KEKW Goin' Flipmode!
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

TheGoat62 wrote: Thu Apr 13, 2023 9:37 am I noticed from the video that the car doesn't make any sounds (except for the gear shift) like it turned into an electric car. Is this a bug from the original game or was it caused by nopping some of the functions you said?
CrabHead wrote: Thu Apr 13, 2023 3:01 pm im 99% sure that is a cause from nopping the functions
I'm not so sure, I haven't really touched anything related to sound, it's all been 3D graphics stuff (though it's not impossible some audio may have been intertwined in there). I have a feeling it might be a Cxbx bug/inaccuracy, but I couldn't be certain at this time.
DrScoop wrote: Thu Apr 13, 2023 3:54 am Will you be providing this for anyone to play (who has a B3 ISO acquired legitimately ;) ) after you have the launcher written up?
Heh, yes if I can get a launcher put together, it will available publicly.
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

I have some good news and some bad news.

The good news is my launcher is pretty much ready. It's available here (binaries can be downloaded from the "Actions" tab if you have a GitHub account). It only compiles for Windows, but runs well in Linux with Wine (use winetricks to install vcrun2019 and d3dcompiler_47). It (obviously) requires a copy of Burnout 3 for Xbox and the latest version of Cxbx-Reloaded.

It's a little clunky to get going right now, you'll probably need to launch Cxbx in advance so you can configure controls (and other settings), and then close Cxbx and run my launcher to actually start playing, but it does work, and you can indeed play around with what I've done up to this point. Having a launcher also opens the door for me to inject an effectively infinite amount of code by injecting my own DLL, rather than just making small patches on the original executable.

The bad news is, I've been looking a lot at the game's code, and the inlining is worse than I thought. My hope was to, at some point, start injecting librw (or even real RenderWare, though I obviously couldn't distribute that myself) to help facillitate porting the game to other platforms. But a lot of functions that I know were RW functions have been aggressively inlined, to the point that much of it has been inlined more than once, meaning the code that remains is all internal D3D stuff that the original source code never would have had any access to.

The result is code that's virtually hardcoded for Xboxes only, despite the fact that we know for a fact it was written to be portable (at least between Xbox and PS2). A lot of function calls have additionally been converted to fastcalls, which improve performance, but are harder to replicate in my code injections.

None of these are dealbreakers - rewriting code is rewriting code, you can ultimately get it to do whatever you want - but it does make things a lot harder, especially from a portability perspective. Injecting RW may be off the table, which is really unfortunate because injecting RW/librw was what I was counting on to give us quick access to other graphics APIs; not just Win/Mac/Linux, but also consoles like the Switch (or, with the original RW, potentially even the poor Gamecube that the Burnout series abandoned after 2). Again, it's not that any of this is impossible the way the code is now, just that without the abstraction that RW provided, it all becomes much, much harder.

With this approach, we'll get a Windows port fairly quickly; I think that's clear at this point. But anything beyond that, I have no idea.



Ironically, for a console that's known to have weaker hardware, the PS2 version of B3 is far less inlined. Before starting this project, I actually spent quite a bit of time using a linker map (that was accidentally left on the June 8, 2004 prototype of B3) to make a fully documented PS2 build (the "secret weapon" I mentioned in an earlier post), and I was hoping to use that documentation while injecting the Xbox version. But it's already proven extremely challenging, since a lot of the functions clearly laid out on the PS2 port have been ripped apart by the aggressive inlining.

I've long felt that this inadvertent documentation would make the PS2 the ideal candidate for decompilation, but this may be an even stronger reason. The PS2 version is just that much more readable. In some ways, it's tempting to jump straight to trying to do that rather than mess around with the Xbox spaghetti code, though I know in reality how much more of a time commitment that will be.

For now, I think we'll proceed with the launcher/injector approach, but I wouldn't be surprised in the distant future if we instead had a port sourced from a PS2 decomp instead.
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

Another reason why PS2 Version of B3 is better :P
I'm going to try playing through the whole game if my sanity allows me to do that with those textures
KEKW Goin' Flipmode!
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

CrabHead wrote: Thu Apr 20, 2023 1:07 pm Another reason why PS2 Version of B3 is better :P
ReallyMad

In all honesty, while PS2 ports generally are worse than their counterparts (due to the slightly less powerful and harder to write for hardware), I will say that Criterion - masters of the PS2 - did a great job making the two ports virtually indistinguishable and ensuring it maintained a consistent 60 FPS on both. The main reason to prefer the Xbox build (outside of simple preference and technical aspects like the x86 CPU making this project possible) is the controls, and that wouldn't be relevant for a decomp since at that point the controller code could just be edited.
CrabHead wrote: Thu Apr 20, 2023 1:07 pm I'm going to try playing through the whole game if my sanity allows me to do that with those textures
Go for it! Let me know if you run into any crashes. I've fixed all of the ones I found, so as far as I know the game should be completable, but it's possible there are more.
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

I might have launched reburn in a wrong way or something, but when i try to launch it it gives me a "Couldn't convert parsed command line!" error. I tried different versions of CXBX, nothing happens. Tried redownloading B3 (although it runs fine on cxbx), still doesnt work. Could you help me with this?
KEKW Goin' Flipmode!
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

Ah my bad, the launcher didn't handle paths with spaces correctly. The latest build should do it.
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

MattKC wrote: Thu Apr 20, 2023 11:18 pm Ah my bad, the launcher didn't handle paths with spaces correctly. The latest build should do it.
Alright! Gonna start testing once im done with usual day stuff
KEKW Goin' Flipmode!
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

It actually runs, there are some microstutters but i've noticed some bugs.

-FMV's can stutter and one of the frames can get "stuck". The video will play on but the stuck frame will keep appearing always after a new frame.

-If you alt tab you lose sound but the game still runs.

-On the topic, sometimes when switching tabs, you can tab in to the game but wont have sound. The way to fix it is to click on the window and it'll work again.

-Like mentioned earlier, *all* cars don't have engine sounds, but AI still has them for some reason?

-Some sounds are delayed (like crashing sounds) or play too early (soundtrack), but the latter part happens rarely.

Notice the pattern that almost all of them are sound related.

That's all the major ones i found besides the broken textures. On that subject, the lack of the barrier texture really makes the game more difficult, but i found it actually generates something from the barriers, although it's a completely different thing?
dat image is big
dat image is big
I uploaded some more footage for anyone to see.
KEKW Goin' Flipmode!
User avatar
TheGoat62
Posts: 16
Joined: Thu Jan 26, 2023 4:38 am

Re: Development Blog

Post by TheGoat62 »

MattKC wrote: Thu Apr 20, 2023 8:39 am For now, I think we'll proceed with the launcher/injector approach, but I wouldn't be surprised in the distant future if we instead had a port sourced from a PS2 decomp instead.
If that's the way it's gonna be; assuming that most people have the PS2 version of B3 readily available on their PCs because PS2 emulation with PCSX2 is easier compared with Xbox emulation could add that the PS2 version is a more viable option to decomp due to accessibility.
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

TheGoat62 wrote: Fri Apr 21, 2023 3:34 pm If that's the way it's gonna be; assuming that most people have the PS2 version of B3 readily available on their PCs because PS2 emulation with PCSX2 is easier compared with Xbox emulation could add that the PS2 version is a more viable option to decomp due to accessibility.
and that you have the early crash+burn demos which have 1000% better crash physics :P

Besides that can you run reburn in fullscreen? you can only have fully sized windowed mode which isnt ideal. Cxbx supports a fullscreen mode and will actually work, but the thing is it's going to launch regular cxbx without injections...
KEKW Goin' Flipmode!
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: Development Blog

Post by MattKC »

CrabHead wrote: Fri Apr 21, 2023 2:23 pm -FMV's can stutter and one of the frames can get "stuck". The video will play on but the stuck frame will keep appearing always after a new frame.
Ahh yes I'm aware of this. Not sure why yet, but will be addressed once the more critical gameplay stuff is out of the way.
CrabHead wrote: Fri Apr 21, 2023 2:23 pm -If you alt tab you lose sound but the game still runs.
I think this might be intentional on behalf of Cxbx? It's default behavior for DirectSound to mute when the main window is inactive unless the DSBCAPS_GLOBALFOCUS flag is specified during initialization. It's something we can do - and probably is preferable - but I'm guessing they haven't done that on purpose.
CrabHead wrote: Fri Apr 21, 2023 2:23 pm -Like mentioned earlier, *all* cars don't have engine sounds, but AI still has them for some reason?

-Some sounds are delayed (like crashing sounds) or play too early (soundtrack), but the latter part happens rarely.

Notice the pattern that almost all of them are sound related.
Interesting, I hadn't picked up on the player car never having sound (tbf I'm doing all of this on a laptop while overseas so my sound is not great right now). It's not unprecedented for Cxbx to exhibit sound issues; a few years ago when I first tried, the title screen music would loop incorrectly every 3 seconds or so. I'm guessing it's just more of that which will need to be resolved.
CrabHead wrote: Fri Apr 21, 2023 2:23 pm That's all the major ones i found besides the broken textures. On that subject, the lack of the barrier texture really makes the game more difficult, but i found it actually generates something from the barriers, although it's a completely different thing?
Ahh yes I've noticed this! They're basically invisible from a distance (they're almost certainly using push buffers), but there is something rendering when you get up close. Very interesting stuff.
CrabHead wrote: Fri Apr 21, 2023 4:09 pm Besides that can you run reburn in fullscreen?
Ahh not yet. I did write a full screen mode, but there's no way to toggle it on without editing the code and recompiling lol. I'll probably have that in by the next build.
User avatar
TheGoat62
Posts: 16
Joined: Thu Jan 26, 2023 4:38 am

Re: Development Blog

Post by TheGoat62 »

The game is playable, been playing for at least 2 hours and haven't encountered any crashes although I find it interesting that the sun shows up whenever you paused the game.

Obviously, this is related to the push buffer issue but from what I've got: the sun's texture only appears if the sun was shown on screen for the first time and disappears when it is out of view from the camera (not blocked by an object or by looking back, just the camera pointing at a different direction) leaving just the sun without its flare. Even restarting, there will be no texture unless you reloaded the whole level from the main menu and no, the sun still goes through the walls which is expected.
sun flare 1.png
sun flare 2.png
It changes colors when you resume then pause the game.
sun flare 3.png
I don't know if this helps but I'm gonna put out what I've found through out my gameplay, if you don't mind.
User avatar
CrabHead
Posts: 199
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: Development Blog

Post by CrabHead »

Another sound related issue. After a crash, all of the in-game SFX are high pitched? It only happens to me now (Super Series, if that's helpful), speaking of which im at the Super Series GP, but i'll stop here because I DO NOT want to play through it again in my life.

I'll still play road rage or try to get into crash mode (will be a giant challenge with the missing textures lol). Anyway, i'm attaching a video of this behavior.
Attachments
I almost wanted to rage quit after this Road rage, i missed ONE takedown...
I almost wanted to rage quit after this Road rage, i missed ONE takedown...
KEKW Goin' Flipmode!
Post Reply