Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Maintenance & Feedback » JJ2+ Issue Tracker

Feature Request Vanilla physics in Plus (Speedrun mode? Open-source part of Plus?)

Simon Simon's Avatar

JCF Member

Joined: Dec 2016

Posts: 58

Simon is doing well so far

Jul 17, 2017, 06:23 AM
Simon is offline
Reply With Quote
Vanilla physics in Plus (Speedrun mode? Open-source part of Plus?)

Hi,

Vanilla JJ2 crashes in Wine between levels often. Plus fixes that crash and works as it should, very good work.

Problem: Plus changes the physics in singleplayer, making speedruns incomparable between Plus and Vanilla. Plus removes some boss quick-kills, removes the bitchslap damage boost in Victorian Secret, etc. What to do?
  • Plus gets a speedrun mode: Medium difficulty with vanilla physics. We wouldn't even need a timer for now. Still, this is work for the devs to make extra UI and special-case the physics.
  • Plus becomes partly open-sourced, so I can learn from that and compile a JJ2 patch that fixes Vanilla's crashes between levels, but doesn't touch physics. Violet wouldn't like Plus entirely open-sourced, mainly to limit multiplayer cheating, and I respect that decision.
  • Make a compelling argument that all runners should migrate to Plus? But for comparing runs over the years, this is the worst option. Plus should fix future physics bugs as appropriate.
  • Declare wontfix because speedrunners on Linux are a minority? After all, Vanilla doesn't crash on Windows this often.
Compared with other speedrunners, my JJ2 times are lousy: I haven't attempted Spaz runs at all, my Jazz run is 29 minutes compared to Binary's 19:40.

Shtrudel has been learning the Jazz run and that sparked my interest again. Even before, I've had the itch several times to run Jazz 2, but didn't do it because I'd have to choose between crashes and physics differences. Shtrudel considers learning the run on Plus, not on Vanilla like everybody else, merely to compare with me.

-- Simon

Last edited by Stijn; Jan 12, 2018 at 03:38 PM.
Stijn Stijn's Avatar

Administrator

Joined: Mar 2001

Posts: 6,965

Stijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to behold

Jul 17, 2017, 09:37 AM
Stijn is offline
Reply With Quote
Quote:
Originally Posted by Simon View Post
Declare wontfix because speedrunners on Linux are a minority? After all, Vanilla doesn't crash on Windows this often.
Realistically, I think this is what will happen. I expect the category of "speedrunners on Linux" isn't much bigger than yourself, to be honest. Of the options you list, a "speedrun mode" is the best solution, but it is a lot of work and for most people there would be very little difference with running vanilla JJ2.

If dual-booting Windows is not an option for you, maybe you could run Windows in a virtual machine and then run JJ2 on it? That would probably be the easiest way out of this.
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Jul 18, 2017, 07:21 AM
Love & Thunder is offline
Reply With Quote
His suggestion could be added to an expanded version of quirks mode?

VMs rarely work for this. I tried running Jazz 2 via VM in Linux a little while ago when I was thinking of primarily switching to Ubuntu. Performance was awful, maybe not even 15fps.
__________________
Stijn Stijn's Avatar

Administrator

Joined: Mar 2001

Posts: 6,965

Stijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to behold

Jul 18, 2017, 07:33 AM
Stijn is offline
Reply With Quote
Quote:
Originally Posted by Robo4900 View Post
His suggestion could be added to an expanded version of quirks mode?
Sure, but that's just another way of phrasing "speedrun mode", not a way to make that less work to implement :P

The thing is that this would require JJ2+ to offer two versions for a variety of physics subroutines, the buggy vanilla version and the better plus version. That's obviously more work to maintain, and it feels silly re-implementing buggy behaviour that has already been patched out, usually for good reason. In some cases the old behaviour may be relatively easy to get back, if it's still in the code somewhere and relatively isolated, but that won't be the case for all physics patches.

It's not necessarily difficult, it's just a fair bit of work. Maybe it will happen! There's an issue for it in the JJ2+ issue tracker already, in fact. But the cost/benefit analysis for this one, for this particular reason, isn't very favourable.
Simon Simon's Avatar

JCF Member

Joined: Dec 2016

Posts: 58

Simon is doing well so far

Jul 19, 2017, 12:38 AM
Simon is offline
Reply With Quote
Quote:
Realistically, I think [declare wontfix] is what will happen. I expect the category of "speedrunners on Linux" isn't much bigger than yourself, to be honest.
Very reasonable -- I've focussed on other games in the meantime. If this issue becomes wontfix, I'll continue and lay aside the Jazz 2 itch for some years.

I've discussed this issue with Violet 6 months ago. Since this issue wasn't mentioned in the Plus 5.5 release notes, I'd like insight on the recent planning, thus this thread.

Quote:
Maybe it will happen! There's an issue for it in the JJ2+ issue tracker already, in fact.
I'll certainly follow the culture, even if I don't run!

Quote:
not a way to make that less work to implement :P
Ideally, it would be my work.

I know that nobody else needs this. It would be egregious to demand so much work and maintenance from others. Plus caters to multiplayer and their own physics, this issue doesn't fit.

I can't patch Vanilla without at least the basic bugfixes open-sourced. I'm a programmer, but I've never hijacked execution and injected methods into binaries. I know where Vanilla crashes in the disassembly. My binary-patching is feeble -- overwriting the instruction with nops makes Vanilla unbootable, and I didn't have other ideas.

The gist: I want exactly one bug in Vanilla patched, the crash between levels. I'd be open to learn how exactly Plus does that. Would the Plus devs share knowledge?

-- Simon
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 867

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jul 19, 2017, 01:07 AM
Seren is offline
Reply With Quote
There are several crashes between levels that I recall but I believe the most prominent cause on Linux to be related to music playback. JJ2 uses parallel threads incorrectly and, as far as I could tell, assumes that one will finish its work in time for the other to have it available. Multiple Linux users reported that disabling music in the game options reduces or completely eliminates crashes; although this was said about JJ2+ before this fix rather than about vanilla JJ2.

Because the error is related to how multithreading was designed in that part of code, a proper fix would be fairly complicated. The fix I wrote for it is essentially an equivalent of duct tape; it doesn't look great, or work great, but at least the hole is gone until a better solution is in place. I can try to help you adapt it to vanilla JJ2 but first please provide the address your crash occurs at to confirm that's it.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Simon Simon's Avatar

JCF Member

Joined: Dec 2016

Posts: 58

Simon is doing well so far

Jul 19, 2017, 01:28 AM
Simon is offline
Reply With Quote
Hah, thanks for the offer. I run in vanilla 1.23.

Between levels, there is a chance to crash at 0x004a2a72 by reading from 0x0.

During levels, exiting the entire program by Alt+F4 can again crash at 0x004a2a72 by reading from 0x0.

-- Simon
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 867

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jul 19, 2017, 03:17 AM
Seren is offline
Reply With Quote
Yeah, that's the address. The line of Assembly that crashes your game is <code>mov ecx, [eax]</code>. It accesses whatever <code>eax</code> is pointing at, and <code>eax</code> is previously loaded from a variable that, presumably, another thread is supposed to write to. JJ2 doesn't correctly test whether this already happened or not, so sometimes it's null, hence the attempt to read from <code>0x0</code>. Thus the proper solution would probably be to create a lock to prevent JJ2 from entering that part until the other thread is finished.

We're not going to be doing that. It's complex and, in code we don't entirely understand, has a lot of room for error. What JJ2+ does is simply test whether the pointer is null and not perform any of the following actions if so. This is a moderately good solution but it also means injecting more code than there's room for. It works for us because we have a setup where we can perform jumps from JJ2 code to our own and back, but it's not easy to do otherwise. You can't insert additional bytes in the middle of the executable without breaking everything, so it may not be a viable solution for you.

You could easily always terminate execution of the function early but this would probably be exactly equivalent to just disabling your music output altogether. Alternatively you could delay the execution of this function more but it wouldn't be guaranteed to eliminate crashes, only make them more sparse. I'll get back to you if I find a solution that's more worthwhile.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
WhiteBlaster WhiteBlaster's Avatar

JCF Member

Joined: Apr 2008

Posts: 58

WhiteBlaster has disabled reputation

Jul 19, 2017, 07:03 AM
WhiteBlaster is offline
Reply With Quote
Curious coincidence, I have been working on similar stuff lately. I've been working on a project that needed injecting a considerable amount of code inside some functions in the JJ2 executable. I COULD have used the spare space at the end of the code section, but that space would have exhausted anyway in the end, jumping all over the place isn't healthy cache-wise, and the compiler used for JJ2 is apparently pretty crummy given the results; so I figured I could optimize the code myself by hand, compressing the existing functions and inserting my own stuff in it.
I'd say that over time I became rather proficient at it; like, with the keyboard state processing routine I managed to save about 47% of the space, while preserving original functionality (hopefully) and without hammering down performance too much.

Just saying that, if you need a hand with this kind of stuff in JJ2+, I'd be happy to contribute.

P.S.: Hi guys, long time no see.
__________________
Mercatura musicae delenda est.

There is a flame untamed
Deep in my heart
Unyielding, pure Ain Soph
'tis measureless
Our right divine:

Aspire to all horizons
To seek nature ov things
Retreat within yourself
To find the primal breath

Behemoth - Transmigrating Beyond Realms ov Amenti
Simon Simon's Avatar

JCF Member

Joined: Dec 2016

Posts: 58

Simon is doing well so far

Jan 8, 2018, 11:21 PM
Simon is offline
Reply With Quote
How is the status of this? It's not urgent at all, I haven't run Jazz 2 in about 4 months.

Isolating the music bugfix still sounds like the best approach. Disabling music altogether dampens the experience. Forcing maintenance of vanilla phyics in Plus is not worth the permanent work.

Consider moving this thread to the JJ2+ issue board.

-- Simon
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,046

Violet CLM has disabled reputation

Apr 1, 2021, 10:12 AM
Violet CLM is offline
Reply With Quote
I don't know anything about the music problem, but I'm getting much closer to being able to implement a proper speedrun mode, and would welcome help brainstorming the list of changes/fixes that should be disabled for that. Things that I've thought might be relevant:
  • Spaz sidekicking bosses
  • Freezing the robot boss
  • Skipping Devan's second phase
  • Ravens freezing in place
  • Enemy and boss functional (i.e. not purely audiovisual) changes introduced in 5.10
  • Powerups for gun6, gun8, gun9 doing extra damage
  • Freedom of movement while using copters
  • Ease of buttstomping crates/barrels/monitors
  • Shooting while pushing crates/barrels/monitors/poles
  • Invincibility period after stomping something
  • Copter-earing onto a flight pickup
  • Carrying bird companions between levels

I've also considered removing the possibility (only during speedruns) of enemies randomly dropping carrots, since that affects your health management at random and doesn't seem fair--thoughts?
__________________

Last edited by Violet CLM; Dec 16, 2022 at 10:53 AM.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,046

Violet CLM has disabled reputation

Apr 23, 2021, 08:27 PM
Violet CLM is offline
Reply With Quote
Update: I've unfixed everything listed in the above post. Still looking for suggestions for what else "vanilla physics in Plus" might include, if I've forgotten anything.
__________________
Simon Simon's Avatar

JCF Member

Joined: Dec 2016

Posts: 58

Simon is doing well so far

Dec 18, 2021, 05:25 AM
Simon is offline
Reply With Quote
Hi, I've promised Love and Thunder to reply here.

You already have a good comprehensive list of differences between vanilla and Plus. Leftover ideas:
  • You should be able to avoid loading the water in Beach 2 by holding jump during level load.
  • Huge boost away from the woman after getting bitchslapped in Colony 1 as Jazz. This didn't work in Plus 5.5 Beta, it works in vanilla.
  • From vanilla, I remember: As Jazz, when you jump into a ceiling and double-tap-then-hold the jump key (?, I forgot the exact inputs), Jazz will immediately copter-ear after touching the ceiling. This allows you to pass Diamondus 2 without activating the bridge crate. And there is a spike section in Castle 1 where the common speedrun route does this, too. This was not possible in Plus 5.5 Beta.
  • From Plus 5.5 Beta, I remember these crate-pushing physics: When you walk up a slope into a crate, your character would sink into the ground.
  • Spaz will vertically clip into ceilings and the run uses that in several spots; those should function. People love such shortcuts. But I don't remember if Plus messed with this part of the physics.
Enemies randomly dropping carrots: The gut feeling is that the probability should stay the same as in vanilla. The randomness is part of the run. Sometimes, you want the health, sometimes, you don't want the health, e.g., for death-warping to a checkpoint. I'd leave carrot drops as they are is in vanilla. They're not a crashing bug, unlike the bubble shield buttstomp crash or the music race.

I still haven't played Jazz 2 since fall of 2017. I follow the community, but AFAIK still nobody but me uses Linux or has such excessive crashing. Don't push this work merely for me. But maybe this mode will entice new runners to try!

-- Simon
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,046

Violet CLM has disabled reputation

Dec 18, 2021, 08:56 AM
Violet CLM is offline
Reply With Quote
Thanks for the reply!
Quote:
Originally Posted by Simon View Post
You should be able to avoid loading the water in Beach 2 by holding jump during level load.
To the best of my knowledge this was never changed, or if it was, it's available again in the most recent release.
Quote:
Huge boost away from the woman after getting bitchslapped in Colony 1 as Jazz. This didn't work in Plus 5.5 Beta, it works in vanilla.
I don't think this has changed either, unless we're talking about different huge boosts. The timing is just unpleasantly precise to the point of feeling mostly random.
Quote:
Spaz will vertically clip into ceilings and the run uses that in several spots; those should function. People love such shortcuts. But I don't remember if Plus messed with this part of the physics.
This sounds to me like part of the "wallclimbing" behavior that can be re-enabled by ticking "Quirks Mode" in the "Plus" dropdown menu, which the speedrun mode will enable on its own. But let me know if I'm misreading you and you're talking about something else.

For each of those except the Beach 2 start, what would be really useful is a .j2m file that reliably demonstrates the behavior in vanilla and reliably fails in JJ2+ v5.9. Otherwise these are super specific key inputs that I doubt I could reproduce on my own. (To create a .j2m, run a level from the command line using the -record option, e.g. jazz2 ./castle1 -record.)
__________________
Simon Simon's Avatar

JCF Member

Joined: Dec 2016

Posts: 58

Simon is doing well so far

May 13, 2023, 05:36 PM
Simon is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
To the best of my knowledge this [skipping the water load trigger] was never changed, or if it was, it's available again in the most recent release.
Now I agree, and I believe J2+ never changed this from vanilla. I looked through my old attempts in J2+ from 2017, and it was possible even in J2+ to skip the water by holding jump.

Quote:
I don't think this [Colony 1 bitchslap damage boost] has changed either, unless we're talking about different huge boosts. The timing is just unpleasantly precise to the point of feeling mostly random.
For reference: This boost happens in Colony 1, on the first roof. BinaryBlob's E1-4 as Jazz in 18:37 uses it around 5:55; the rightwards boost happens roughly a second after health drops from 5 to 4 hearts.

It's possible that you're right, and it's merely precise. I don't have Jazz 2 installation around to test here, and (unlike with the water skip) I don't remember if I discussed possible differences (between vanilla and J2+ about this boost) with BinaryBlob or Dominator_101.

Quote:
This [Spaz clipping into ceilings] sounds to me like part of the "wallclimbing" behavior that can be re-enabled by ticking "Quirks Mode" in the "Plus" dropdown menu, which the speedrun mode will enable on its own. But let me know if I'm misreading you and you're talking about something else.
I believe that, yes, this upwards-clipping behavior is wallclimbing, and we're talking about the same thing.

(Sorry for the absurd delay -- I've read your answer in December 2021 already, and put off an immediate reply.)

-- Simon
Reply

Thread Tools

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 -8. The time now is 04:40 PM.