Posts for jdaster64

jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Forgot I never posted the RNG script here ("mlss_rng_util.lua", note that it needs the "lib" subfolder in the same root for dependencies): https://drive.google.com/open?id=0B6rwv4LXkEwMVG4wZ3hIckNwQkE Use the "M" button to change between modes: - "Predict and Tweak" - shows the next 20 RNG values (scaled from 0.0000 - 0.9999) and allows you to edit upcoming values. - "Predict Reseeded" - shows what the first 20 RNG values will be after the start of a battle given the number of frames it will start in (I think the RNG gets seeded in one of the first couple full-yellow screen frames). - "Bonus Wheel" - shows what the level-up wheel will be for a given stat / brother with the current RNG state. The bonus wheel mode in particular needs some more features (plus, it only works on U, and there's a particular branch in the assembly code that never came up in my testing but might be used in some cases).
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
I'm planning on making an improved RNG viewer script at some point this weekend, if I have the time. Random stuff I've been looking into over the past day... Found out what the RNG seeding function is (basically the same as the one here), and that it is in fact seeded by the global timer (or at least its last 16 bits) when starting a battle, so I should be able to write a script that predicts the initial RNG values for if you start the battle on the next frame. I also fully disassembled the level-up bonus stats routine; haven't cleaned up my notes much but I understand the gist of what everything's doing, and know what all the inputs mean. Ideally, I should be able to add that to the script as well. Also, I found an error in my Fire Bros. Advanced damage calculation from my script; turns out the success multiplier is 115.2/256 (yay, floating-point), not 115/256. The new version of that script is here (and should be updated if I make further changes).
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Can't recall exactly, but I think I first became aware of the site due to the Super Demo World: TLC TAS (the 2005 one, since this would have been some time in '06). Had recently gotten into YouTube, watching speedruns, and experimenting with LunarMagic, and one thing led to another.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Didn't know there was a thread for this sort of thing; I've been recording Nintendo arrangements for a good while now on my YouTube channel. I've also recently been putting a few random old things on SoundCloud, but I don't have much there yet.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Ooh, how did I not know about this before? Seems like it'll address Dolphin's lack of Lua support and CE's lackluster native support for dynamic memory watching in one stroke; excited to try this out!
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Potato Stomper wrote:
Physics are the same as in SMB1.
Modulo bounce heights on enemies and trampolines; the former is higher even for Mario, and the latter no longer changes based on X-speed (and also has a fixed gravity regardless of player).
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Yeah, I must have tuned out right before the SM64/Portal streaming stuff was explained. Really impressive from a tech standpoint, but I feel it might have had a better reception if it were explained more beforehand.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
I assume this video and audio data has to be loaded in real-time via ACE; I'd have to think even with hardcoded data, that'd be super taxing on the SNES's RAM / CPU, let alone the input polling frequency this'd require. What kind of format did this require?
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
The RNG is always completely reseeded on any battle start; prior RNG manipulation doesn't matter (although the results do differ, probably based on time). Like you said, not a ton that can be done to manip once inside the battle. What are the "RNG base values" you're talking about? As far as I know, the only RNG source is a Mersenne Twister, which has a lot more than 2 values' worth of state. Assuming those are still just pointers into the real RNG seed space, you should probably try replacing those values with RNG stuff from my scripts.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
IIRC, those dummy values are the chances of getting a Lucky hit (5%) and the amount of damage done w/all solo and Bros. attacks, all on the enemy in the first slot (which I assume would be a Fighter Fly). They were really only meant for testing. You can tell that it knew a Lucky hit was coming, though, since it had a higher number for Mario's solo Jump / Hammer attacks until you landed the attack. Alternatively, the next RNG value, 0x0CC411C5, is less than 0x100000000 * 5 / 100.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
IIRC, the triggers for the item/badge shops are: - After clearing the Sewers (BBCT 1) - After clearing Chucklehuck Woods (BBCT 2) - After clearing Woohoo Hooniversity? (It's some time before beating Mom Piranha) (BBCT 3, LF 1) - After Princess Peach is kidnapped (BBCT 4) - After collecting the Beanstar Pieces (BBCT 5, LF 2) - After beating Popple+Birdo (BBCT 6, LF 3) I believe the Teehee Valley enemies change after Princess Peach is kidnapped, as I'm pretty sure I encountered them on the way to S.S. Chuckola via the top entrance.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
I had been using CE and the Dolphin debugger in tandem, yes (and I tried again after break-on-write was fixed). No luck in finding anything manipulable, though.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
POW is determined by the attack used, not the enemy; there isn't a "POW stat" per se.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Been looking into RNG in Mario Party 5; found what appears to be a classic RNG function (x * 0x41c64ed6 + 0x3039), but it's only called in one place and the result appears to be immediately trashed. Really bizarre; I'll continue looking into it, though. EDIT: Tried a number of techniques, couldn't find anything else; my guess is the random function actually used is too 'naive' for any of the usual routes to find it, and without breakpoints on memory write, I doubt I'll be able to tie it to an observable use of randomness easily.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Great stuff! I don't suppose a speed boost in the line game is possible / would save time?
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
I'll have to catch that at a later date; I'm going to be out of town then. Congrats to all involved for their hard work!
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
False, they do actually affect your power. Luigi's average damage goes down a bit each upgrade (although the maximum goes up a bit); don't know about Mario's offhand, but it does change as well. The constants are taken into account in the damage calculation scripts, at any rate. Edit, relative powers: Mario Normal - 0.9, 1.0, 1.1 Mario Super - 0.8, 1.0, 1.2 Mario Ultra - 0.8, 1.05, 1.3 Mario Lucky - 2.1 Luigi Normal - 1.0, 1.15, 1.3 Luigi Super - 0.9, 1.13, 1.36 Luigi Ultra - 0.8, 1.1, 1.4 Luigi Lucky - 2.5 Edit again: No difference on Bros. attacks, since I didn't say so explicitly.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Here's the script for BizHawk; let me know if anything else needs explanation. https://www.dropbox.com/s/psvlichjvegg3o3/jdaster64_mlss_scripts_v2.lua?dl=0
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
All right, I finished updating the script for VBA; before I port it to BizHawk, let me make sure these interfaces seem all right... Damage calculation: For damage calculation, you need to pass this struct:
DamageCalculationInput = {
    EnemyID,
    PlayerID,
    
    PlayerPow,
    PlayerPowMult,
    PlayerBadgeEffect,
    EnemyType,
    EnemyDef,
    EnemyDefMult,
    MushroomCounts = {n, s, u, m},
    CurrentHammer,
    GreatForce,
    IsLucky
}
You can either set EnemyID to an actor # (0-5) and it'll calculate the attack power based on the in-game battle data, or set all of the inputs after PlayerID to calculate what the attack power would be without using the in-game data. PlayerID should never be set; it will be set automatically if you use EnemyID, based on which attack you request the power of. The functions you call with that data are as follows: Solo attacks: {mario | luigi}{Jump | Hammer | Hand | CounterJ | CounterH}(dci) Examples: marioJump(dci), luigiCounterH(dci) Bros. attacks: {splash | bounce | chopper | knockback | fire | thunder | swing | cyclone}{Bros | BrosAdv}(dci, (hits/strength if applicable)) Examples: splashBros(dci), knockbackBrosAdv(dci, hits), swingBros(dci, strength) Lucky! chance: To calculate the chance of a Lucky! hit, use the following struct:
LuckyCalculationInput = {
    EnemyID,
    PlayerID,

    PlayerStache,
    PlayerLevel,
    EnemyStache,
    EnemyLevel,
    LuckyAttack
}
Populate EnemyID & PlayerID (use MarioActorID or LuigiActorID for that) to read from memory in battle, or the rest of the values to try out arbitrary inputs, then call the function luckyChance(lci). Doesn't support the Lucky Mushroom effect, nor do I intend to support it since it's implicitly supported in the in-battle case anyway. Stache discounts: Call buyPrice(base,dg,stache) or sellPrice(base,dg,stache), using the base price (not the sell price) of the item, its discount group (0 to 5), and the appropriate STACHE value (Mario's or Luigi's alone if only he can use the item, or their average rounded down if either can). RNG stuff: nthRandRange(n,range): Returns the result of rand(0,range) using the Nth RNG value. N is 0-indexed, not 1-indexed, and the function isn't guaranteed to work for N greater than 290-ish. untwistInRange(n,range): Given a desired value N as the result of rand(0, range), returns an RNG seed value that produces the desired result. Can be useful for testing something with a desired random value, although it won't be of any help if the random engine is pointing near the end of the random buffer.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Just finished refactoring the script to support J/E; I'll convert to BizHawk support in the next couple of days, and might add STACHE discounts as well. Currently, the script's only going to accept enemy target and number of hits as parameters, and use the current stats of Mario/Luigi and the target enemy to calculate damage; if you want to have it calculated on an arbitrary set of inputs, I can add that functionality, but that might take a bit longer; this would have to be a minimal set of inputs to do all calculations: DamageCalculatorInput { PlayerPow = ... PlayerPowMult = ... PlayerBadgeEffect = ... EnemyType (ID) = ... EnemyDef = ... EnemyDefMult = ... GreatForce = ... MushroomCounts = ... CurrentHammer = ... IsLucky = ... } It would be doable, although for my sanity's sake, I'd rather it still autodetect the game region, as that'd be a major pain to make configurable (plus, you could always change the GameVersion/Region before doing the call and set it back afterwards).
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Not familiar with BizHawk's memory domains, but actordata() should probably return the value at that address - 0x2000000 rather than just the value; not sure if there are other cases where I dereference an in-memory pointer. I can add support for J/E tonight and do the conversion if you'd like; what are you doing to tell the version of the current ROM, so I can keep it consistent with that?
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
For the record, vba-sdl-h is a command line emulator with a debugger, so you can set breakpoints. If you know a memory address that's likely to be closely linked to an RNG call, it makes finding the random state pretty trivial. If the game's on a system that doesn't have an emulator w/ debugger support, you will have to fall back to RAM searching for changed values, though.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Luigi definitely has lower ground speed when not riding Yoshi IIRC (by 4 subpixels/frame); that video's a misleading comparison.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
Anything that checks if you get a Lucky hit will run the RNG once, and it changes a couple of times when each enemy dies.
jdaster64
He/Him
Experienced Forum User
Joined: 12/1/2012
Posts: 103
Location: New Donk City
https://www.dropbox.com/s/5ket9o79rmzh9ix/mlbis_stats.xlsx?dl=0 Here's an Excel doc with enemy stats; not sure where an in-game address is, but this'll give you the values to look for. I only have the (U) version to test anyway...