Author Topic: Liberation Day R&D Bug  (Read 2619 times)

Offline Wakuseino

Liberation Day R&D Bug
« on: November 10, 2015, 07:59:04 pm »
As the name suggests, this is for... the various R&D bugs I've found. I will continue exploiting that one to see how far I can go before R&D related crashes happen!



In short, the problem is that by moving your intel spending and cancelling upgrades, you can actually reduce the costs of things to below the original base. In addition, because of the 100% refund aspect, you actually earn money by doing this in addition to the savings caused by reduced costs.

Of course, this doesn't happen for everything, but the weapon damage upgrades seem particularly vulnerable to this. I eventually decided to test to see how low I can get some of the costs and have successfully managed to reduce the Sunrider's energy damage costs to 2. At 2 Cost, it cannot go any lower... and it cannot go any higher. From then on, all energy damage upgrades on the Sunrider cost 2 to upgrade, no matter how upgraded it is.

...And this is the story of how I have begun creating Sunrider the laserboat.

*Ehem* Having gone through the Sunrider, the upgrades that have that happen are the Energy Upgrade, the Kinetic and Energy Damage upgrades, and the Flak Upgrade. I haven't tested with other ships yet.

...And not coincidentally, It is possible to upgrade lasers so much that they crash the game. That's the... 18th upgrade, I believe? It'll crash if you upgrade the damage once lasers are at 540 base damage.

Code: [Select]
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 1333, in script
    ava "Captain, I feared this would happen..."
  File "game/upgrade.rpy", line 1, in execute
    screen upgrade:
  File "game/upgrade.rpy", line 1, in execute
    screen upgrade:
  File "game/upgrade.rpy", line 276, in execute
    vbox:
  File "game/upgrade.rpy", line 279, in execute
    viewport id "upgrade_list":
  File "game/upgrade.rpy", line 295, in execute
    vbox:
  File "game/upgrade.rpy", line 300, in execute
    for upgrade in upgrade_list:
  File "game/upgrade.rpy", line 301, in execute
    if upgrade[1] == None:
  File "game/upgrade.rpy", line 322, in execute
    hbox:
  File "game/upgrade.rpy", line 353, in execute
    if level < 19:
  File "game/upgrade.rpy", line 361, in execute
    text ' -':
  File "game/upgrade.rpy", line 361, in keywords
    text ' -':
NameError: name 'cost_width' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 1333, in script
    ava "Captain, I feared this would happen..."
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\ast.py", line 594, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\exports.py", line 1032, in say
    who(what, interact=interact)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\character.py", line 826, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\character.py", line 688, in do_display
    **display_args)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\character.py", line 491, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\core.py", line 2346, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\core.py", line 2602, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\core.py", line 394, in visit_all
    d.visit_all(callback)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\core.py", line 394, in visit_all
    d.visit_all(callback)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\core.py", line 394, in visit_all
    d.visit_all(callback)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\screen.py", line 386, in visit_all
    callback(self)
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\core.py", line 2602, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\screen.py", line 396, in per_interact
    self.update()
  File "C:\Dustin\Games\SunriderLiberationDay-B10-all\renpy\display\screen.py", line 565, in update
    self.screen.function(**self.scope)
  File "game/upgrade.rpy", line 1, in execute
    screen upgrade:
  File "game/upgrade.rpy", line 1, in execute
    screen upgrade:
  File "game/upgrade.rpy", line 276, in execute
    vbox:
  File "game/upgrade.rpy", line 279, in execute
    viewport id "upgrade_list":
  File "game/upgrade.rpy", line 295, in execute
    vbox:
  File "game/upgrade.rpy", line 300, in execute
    for upgrade in upgrade_list:
  File "game/upgrade.rpy", line 301, in execute
    if upgrade[1] == None:
  File "game/upgrade.rpy", line 322, in execute
    hbox:
  File "game/upgrade.rpy", line 353, in execute
    if level < 19:
  File "game/upgrade.rpy", line 361, in execute
    text ' -':
  File "game/upgrade.rpy", line 361, in keywords
    text ' -':
  File "<screen language>", line 363, in <module>
NameError: name 'cost_width' is not defined

And another edit: Research indicates that the same seems to apply to Kinetic damage as well. I assume upgrading anything up to that point causes the crash.

On the bright side, double-checking the intel info indicates that one does in fact lose some intel from pulling this cost degradation... Not that it. Doesn't pay for itself.
« Last Edit: November 10, 2015, 08:47:32 pm by Wakuseino »

Offline Vaendryl

Re: Liberation Day R&D Bug
« Reply #1 on: November 11, 2015, 12:08:30 am »
seems like I should round my numbers properly instead of just flooring everything >.>
I'll also have to look into why it would crash at that point.

btw, I like how it says "RYDER:SUNRIDER". only just noticed that.
« Last Edit: November 11, 2015, 12:20:20 am by Vaendryl »
(╯□)╯︵ uoıʇdǝɔxǝ
latest version: 7.2
RTFW
Mark 5:9

Offline Endershadow

Re: Liberation Day R&D Bug
« Reply #2 on: November 11, 2015, 04:15:32 am »
seems like I should round my numbers properly instead of just flooring everything >.>
I'll also have to look into why it would crash at that point.

Might I suggest not rounding the actual amount and only rounding when displaying the actual amount?

btw, I like how it says "RYDER:SUNRIDER". only just noticed that.

That's pretty funny

Please be careful not to fall into any holes in reality caused by my reality hole generator. If you do fall in though, I can assure you that there will be no adverse side effects except for the following: instantaneous mutation, loss of 1 or more vital organs, turning into banana pudding, amnesia, loss/growth of 1 or more limbs, additional vital organs, loss of DNA, insanity, hallucinations, destruction of the fabric of space and time, redundancy, redundancy, a craving for apples, the ability to see shinigami, for females: an erection lasting more than 4 hours, for males: extremely painful menstrual cramps, testicular inversion, gender swapping, the urge to watch my little pony, and/or death

Offline Saotome

Re: Liberation Day R&D Bug
« Reply #3 on: November 12, 2015, 05:45:30 am »


Might I suggest not rounding the actual amount and only rounding when displaying the actual amount?


I believe this would create another problem... Imagine an upgrade costs 199.3 and you have 400 to spend. Now, if you round this only to show the numbers on screen, it is probable that the number being displayed is 199, and therefore you expect 201 to remain in your balance. However, you'd actually have 200.7, which rounds to 201. So far, so good.

Now, if there was another upgrade like that and you were to spend your "201" on it, you'd end up with 0.4, which rounds to 0 instead of 1.

True, this is much harder to notice, but it's not a solution. Rounding numbers on the fly can be tricky. I'd consider creating a small database with preset values for the upgrades' costs and refunds, going perhaps to the 20th level for each value. It's unlikely anyone will try upgrading higher than that, and even if they do you can always show a message "Hey, this is the Sunrider, not the Legion! Further upgrading is Forbidden!" :P

Now, being serious, that database could be used to store values calculated on the fly more or less like this:

Once player clicks on upgrade X -> system checks if X+1 upgrade was calculated before and stored inside the database
if so -> new cost is loaded from database and replace value X as the next upgrade
if not ->  system calculates upgrade X+1 to be displayed (rounded, floored or the way you want) and stores that value inside the database

When downgrading there will always be upgrade X-1 inside the database, so just load this value and apply the 20%(?) penalty (rounded down to prevent exploits like the one on this post) and exhibit cost X-1 loaded from the database.

... I'm probably speaking to veteran programmers who will think this is a terrible solution for reasons I can't (yet) understand... I do hope to have helped :D , but if I didn't... well, sorry :-[