Post subject: Luminous Arc
Joined: 3/10/2018
Posts: 4
Luminous Arc is a tactical RPG released for the DS in 2007 by Imageepoch and Marvelous Entertainment. Combat is similar to that of the Final Fantasy Tactics series in that units take turns moving and taking actions on an isometric grid, with the option of not moving and/or not taking any additional action to make the next turn for that unit come sooner. The game also features intermission scenes between battles in which the player can converse with a chosen party member, leading to a prompt to select a response. The chosen response determines how much the player's bond with that character increases and there are a finite number of conversations to be had with a given character per cycle. Items are received at specific levels of bond, with the specific items varying by character, and reaching the maximum bond can often reward powerful items. Some of the earlier rewards can also be very strong for how early they're available. This game will be my first attempt at a TAS. There is, to the best of my knowledge (and my disappointment), no existing real-time speedrun nor TAS of this game. There is however an any% NG+ speedrun of one of the sequels, Luminous Arc 3. I decided that instead of waiting and hoping that someone else picks up the game I'd start the ball rolling myself. There is a new game plus feature but my intent is to start from a new game rather than continuing from a verification movie. This feature could however be used for a run showcasing the post-game bonus dungeon. I have in the past spent a lot of time looking into the mechanics of the game. I also previously attempted (unsuccessfully) to make a real-time speedrun route for this game, routing out the first 6 chapters (of 25). I stopped when it became apparent that the mostly (at least at first) predictable AI was occasionally instead wildly unpredictable, and that this tended to lead to the other enemies becoming unpredictable too. This was a major issue as without the inclusion of a grinding segment some fights became close to unwinnable with bad AI patterns, and the full HP and MP heal upon level up means exp routing is likely crucial anyway. This is why I have decided to instead make a TAS, as AI RNG manipulation should solve this issue. Things I discovered during routing:
  • RNG for hit checks and damage rolls appears to be fixed per fight. Neither actions in previous fights nor during the current fight seem to influence these. Avoiding an unwanted miss with a normal attack (magic and skills are 100% accurate) seems to only be possible by delaying the unit's turn to have another unit attack instead. Likewise it doesn't seem to be possible to manipulate for an enemy to miss.
  • Enemies tend to prioritise attacking from behind, so unit facing can be used to manipulate AI actions.
  • Turning voices off seems not to save time as delays relating to them still seem to be present.
  • Vitae (used for imbuing equipment) rewards appear to be fixed for the first clear of a map, random on future clears.
  • Text skipping is best done by alternating between A and the touch screen.
Things I discovered so far while TASing the game:
  • Many selections during battle can be made before the corresponding UI element is visible. How far in advance seems to occasionally vary by a frame (possibly due to lag frames).
  • Touch screen inputs seemingly need to be held for 2 frames instead of 1 during battles.
Important notes/current plans/things to look into:
  • Movement is used to determime turn frequency (similar to how speed is used in some other games) as well as how far a unit can move. This makes movement an incredibly important stat.
  • I plan on doing Leon's intermissions first for the Redline accessory (ATTACK +100, GUARD -100) as this is an enormous power boost at the cost of turning someone into a glass cannon. This also rewards the IronBrce accessory (ATTACK +6) at the end of chapter 4 which saves a turn in the first fight of chapter 5 (which is also usually considered a hard fight in a normal playthrough). For comparison the strongest purchasable accessory at this point is a Brace (ATTACK + 2).
  • If I do obtain the Redline it would probably be given to Saki as she's tied for highest movement (and by extension turn frequency) and her weak-but-long-ranged Chi Strike skill becomes deadly early on with it equipped.
  • The input mode for battles can be switched between two different touch screen modes and button mode. Touch screen is the default and seems the fastest for movement and selecting targets. It is however possible to switch modes during battle and button input may prove faster for confirming inputs that otherwise require double-confirming with the touch screen.
  • If turning off voices reduces lag frames then it may be faster after all.
  • A choice at the start determines which vitae can be received much later on. At this stage I'm unsure of which set of them I will want.
If anyone has any thoughts then please share. Does this seem like a good/bad game to TAS? Does anyone have any ideas/suggestions of their own that could be looked into? Maybe someone else is interested in taking a crack at it?
Joined: 3/10/2018
Posts: 4
Update: Unvoiced dialogue can be sped up on all non-lag frames. There's usually a lag frame after 2 inputs during these sections so typical skipping input looks like: A, touch screen, lag frame, A, touch screen, lag frame, ... In rare instances there's no lag frame and dialogue can be sped up on 4 or more consecutive frames. Voiced dialogue can only be skipped after a delay that somewhat relates to the length of the voice clip. For short clips this tends to be around 3-6 frames but for some it's much longer. Like with unvoiced dialogue you typically want to follow an A press with a touchscreen input (or vice versa). Lag frames seem somewhat erratic during these sections and desyncs are extremely common when saving frames earlier in the movie. When transitioning into a voiced dialogue section from a previous scene it's usually possible to make the dialogue appear sooner with an A or touchscreen input on the correct frame during the transition. Not only does turning voices off not seem to allow voiced dialogue to be skipped any faster, it doesn't seem to reduce lag frames either. If anything it seems to potentially increase them. I haven't found any RNG-related addresses, however AI behaviour seems to use the same RNG as determining which direction to move first when moving diagonally. As far as I can tell this RNG is seeded upon selecting "GO" to start the fight and only advances when a random number is needed. This means it is possible to move a unit 1 space diagonally and cancel the movement to advance the RNG. This is fairly slow however so may be of limited use. Characters can sometimes randomly (unless I've missed what the cause is) not call out before taking a turn, which tends to save upwards of 60 frames. This also seems to be determined when selecting "GO" but doesn't seem to use the same RNG. Button mode is indeed faster (by 3 frames) than either touch screen mode for facing a different direction than is selected by default when waiting. It is possible to switch between touchscreen modes at the same time as selecting a command with the touch screen, and it is possible to switch to button mode between choosing to wait and the waiting direction being selectable. However I have yet to find a way to change back to touchscreen mode without losing more than the 3 frames saved and touchscreen is much faster for selecting distant tiles for movement or targetting with ranged attacks, especially if the path is a straight line. I've also yet to find another good opportunity to switch to button mode - the input for doing so is rarely accepted other than during times when other inputs are required, and it doesn't appear to be possible to select a menu option and switch to button mode simultaneously (unlike switching between touchscreen modes). Button mode may also be faster for selecting the topmost option from a list of skills or magic, but I haven't tried this yet because of the previously stated issues with changing input modes. Here's a WIP showing chapter 1: https://www.youtube.com/watch?v=ck2BXCWR8Nw I intentionally take an extra action during the fight for better exp distribution. The intermission mechanic doesn't show up until chapter 3 so isn't seen here.
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
I got in contact and we started working on this together. Made a new battle 1 strategy that should save more than 20 seconds: https://www.youtube.com/watch?v=a99nas_-iUs Gonna work on battle 2 now I guess. Edit: Quick magic test showing Lucia’s Shine is 234 frames slower than a melee (camera scroll affects this): Edit: abusing stored input this becomes 231 frames slower I guess. https://cdn.discordapp.com/attachments/430487561694347264/432008798090297344/unknown.png https://cdn.discordapp.com/attachments/430487561694347264/432009266795249675/unknown.png Since picking a spell takes so much with touch (2f select, 1f release, 2f confirm) you can switch to buttons and then switch back to touch before targeting and finish even. It would save a frame if it didn’t create an extra frame of lag (not sure whether that always happens or not). (Picking spell with buttons is 3f faster switching included.) Also a strange touch input storage bug: by pressing f1 touch, f2 touch + select, you can switch to button commands and store the touch input, which gets released as soon as you switch back to touch commands: https://www.youtube.com/watch?v=-woEoUulSAo INPUT STORAGE CAN BE USED TO SAVE TIME!!! https://cdn.discordapp.com/attachments/430487561694347264/432018647653810188/unknown.png Since switching can be done 1f before button inputs during menus, and the top option is tied between buttons and touch, switching to buttons during a menu doesn’t lose time if it’s the top option (loses 1f for the second option because you can’t Down + A). You can store input wherever you want on the screen as long as you’re pressing on actual input frames, so f1 touch f2 touch + select f3 down f4 A for example selects Magic while only wasting the 1 frame of Down input, with a touch input stored. You can then save 3 frames selecting the top spell because buttons don’t need to select it but just confirm it unlike touch which is weird for some reason, and you have a total of 2 frames saved. Also, you can switch from 1 touch mode to the other without wasting any inputs so this can be repeated any amount of times you want. Edit: Oh man I’m stupid, no need to waste frames menuing with buttons! Just store the input right before selecting the spell/item/skill/whatever. https://cdn.discordapp.com/attachments/430487561694347264/432027014862471170/unknown.png
Active player (261)
Joined: 12/13/2016
Posts: 352
Have you guys done any tests which varying the start time/date of the emulator for initial RNG setup?
Joined: 3/10/2018
Posts: 4
Time/date do not appear to be involved with anything RNG-related for this game. We did however discover that the RNG for movement paths/AI behaviour can be advanced simply by viewing the movement range for a unit (by selecting "Move" or by scrolling through the turn order list). This means that canceling a movement isn't required.
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
Battle 4 strat with RNGs viewer Lua: https://www.youtube.com/watch?v=4q3FkR6F4tQ Lua: http://tasvideos.org/userfiles/info/46689399252165655 Edit: updated link This game has 3 separate RNGs for some reason yet they all use the same formula. Edit: FOUR ARGGGHHHHHH improved battle 4: https://www.youtube.com/watch?v=gzzNSfr3_JU Edit: So Nietono found the voice clip RNG. That’s 4 total RNGs… this game is crazy. Anyway, ≤ 1431699455 RN = voice ≥ 1431699456 RN = no voice so it’s a roughly 1/3 chance of getting a voice clip (33.334350562654436%) assuming true randomness which RNGs aren’t. (Don’t forget if you’re freezing the RNG you need to input the RN 1 step before your target, if you freeze 1 for example you’ll get no voice because 1 advances to 1568614952.) Also at a character’s turn start (which is where RNG voice clips happen) depending on your HP one of 3 voice clips will play, thresholds are: 100–66%, 65–26%, 25–1% HP. Note that “mid”/“low” HPs are a forced voice clip regardless of RNG the first turn they happen for a character. Oh and the voice clips RNG is seeded on your first turn in map 1 with the frame count and some other random shit, then proceeds to just use the below formula every time it’s called. This means that the start of the game will determine all future RNG voice clips (which waste like 1 second each time) with very little ability to manipulate it in-battle. Isn’t that fun… Also you can see it from my Lua but I guess I can post the RNG formula here too: xnew = (1566083941 × xold + 2531011) % 2^32 inverted: xold = (1786162797 × xnew + 3284393209) % 2^32 Edit: Encounter is ≥ 2147483648 yes, ≤ 2147483647 none, 50% chance.
Joined: 3/10/2018
Posts: 4
The bot I've written for executing our strategies seems to be generally capable of frame-perfect execution under typical circumstances, and has some functionality for handling certain unusual circumstances. Sometimes the game accepts a confirmation 1 frame earlier or later than expected but the bot can be told to do a specific confirmation earlier/later than normal. The bot doing ALAKTORN's map 1 strat can be seen here: https://www.youtube.com/watch?v=jP057QJyFlY The last uploaded version of the bot: http://tasvideos.org/userfiles/info/47012472401979611 It turns out that there are 2 RNGs seemingly used for the AI which advance together, of which one advances the same way as the rest but the other advances based on the previous values of both AI RNGs. We originally thought this was determined along the lines of: x2new = (1812433253 × x2old + 1566083941 × x1old) % 2^32 However this wasn't quite giving us the correct results. It seems it's actually along the lines of: x2new = (1812433253 × x2old + 1566083941 × x1old + floor(1812433253 × x1old / 2^32)) % 2^32 We haven't determined how exactly these random numbers are used yet. Damage rolls behave very strangely. They appear to, at least for physical attacks and skills, add damage after other calculations are done. This random part is seemingly unaffected by facing/elements/skill multipliers/etc and applied after damage would otherwise be reduced to 0 against a target with a high Guard stat. Curiously, ranged physical attacks use Attack for the bulk of their damage but Tech for the randomised part (with a higher multiplier, presumably to make up for Tech usually being a much lower stat than Attack). Spells use Magic for the randomised part, as would be expected, and have a different multiplier again. Facing bonus for hit rate and damage appears to be 1.07× for a side hit and 1.12× extra for a back attack. Hit rate appears to be rounded down to the nearest 1% both before and after this bonus is applied. I haven't determined where the flooring in damage calculation occurs. Whether a direction that isn't in a straight line is treated as side or front/back hits depends on which way the target is facing - the facing check seemingly doesn't work correctly. It seems a unit facing the bottom right or top left will take side damage from anything that isn't in a straight line, whereas a unit facing top right or bottom left will take front/back damage from anything that isn't in a straight line. I need to look further into how elevation influences damage, but so far it seems that some attacks deal increased damage from a higher elevation whereas some deal decreased damage instead. Elemental advantages works differently for physical attacks and spells. For physical attacks elements are applied after Guard is subtracted:
  • Slight elemental advantage deals 103% damage.
  • Slightly resisted damage deals 96% damage.
  • Elemental advantage deals 108% damage.
  • Resisted damage deals 93% damage.
If an elemental weapon is equipped then both elements are compared to the target's element and the respective multipliers appear to be applied multiplicatively. If an elemental weapon is equipped and the target has elemental armour then the element on the weapon is compared against the element on the armour and the corresponding multiplier is also applied multiplicatively. Elemental armour appears to do nothing if the attacker doesn't have an elemental weapon. For magical attacks elements are applied before Resist is subtracted:
  • Slight elemental advantage deals 110% damage.
  • Slightly resisted damage deals 90% damage.
  • Elemental advantage deals 125% damage.
  • Resisted damage deals 80% damage.
Ordinary spells are treated as being of the same element as the caster (meaning Pollon having multiple elements of spells is actually pointless). Saki's elemental skills use their correct elements however. Spells are unaffected by elemental equipment (weapons or armour). Damage from physical attacks appears to be (not sure where flooring happens): ((Attack × 1.35) - target Guard) × skill multiplier × elemental × other modifiers + attack roll × Attack Or for ranged attacks the last part is ranged roll × Tech instead. Damage from spells doesn't seem to be affected by facing nor elevation. Damage from spells appears to be (not sure where flooring happens): (Magic × elemental - target Resist) × spell multiplier + spell roll × Magic Hit rate as a percentage seems to be (capped at 99%): floor((floor(100 × Tech / target Speed) - 5) × facing bonus)