CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.67k stars 4.18k forks source link

Power Capped at 2120 kj? #34501

Closed Pmm5000 closed 5 years ago

Pmm5000 commented 5 years ago

Describe the bug

Well, it's not actually capped at 2120 kj. Probably. Like I have this custom bionic right?

[ { "id": "bio_power_storage_mkIII", "type": "bionic", "name": "Power Storage Mk. III", "capacity": 2500, "description": "A Compact Bionics Module that increases your power capacity by 250000 units."

} ]

And I've just have been playing with that capacity number for a while now. And 2100 worked while 2200 did not. And honestly, I'm getting a touch annoyed with this problem. Anyways, it would appear that if you just so happen to have too much power capacity the default power capacity then becomes -2127, which leads me to believe that the power capacity is now 2126, maybe 2127.

Anyways....the bug I'm reporting is that this is most certainly not a 16 bit cap (65536) and I'm not entirely sure how to fix it.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Give a profession 10 Mk II bionics (this should give 2500 power)
  2. Note down the power (at the time of doing this gave me -1524 kJ)

alternative

  1. Create a custom bionic that let's you change the power more accurately.
  2. Attach it to a profession.
  3. Start a new game.
  4. Note down the power.

Expected behavior

A clear and concise description of what you expected to happen. Ideally also describe why you expect it to happen.

Well. I asked what is the max power in another post a couple days ago, and a kind fellow gave me an answer stating that ideally it should be at least 16 int number. Plus this link explaining things. https://en.cppreference.com/w/cpp/language/types

Then with bits being what they are, 0 or a 1, you have only 2 options. Then given what I learned in computer engineering course, you can get bigger numbers by adding more bits, and you figure out the maximum number in decimal by simply doing 2^number of bits (in this case 65536 or at least half that). So my question now is did I accidentally break the game or is this rather small cap (my opinion) intentional?

Screenshots

Screenshot one with 11 mK II power storages image

Screenshot 2 with 10 mk II power storages image

Screenshot 3 with 8 mk II power storages image

Screenshot 4 with 9 mk II power storages image

Versions and configuration

For screenshot one

Screenshot 2 onwards

Additional context

Add any other context about the problem here. Here's my custom profession using Magiclysm. { "type": "profession", "ident": "wizard_novice", "name": "Would-be Wizard", "description": "You found a pamphlet with bright colors claiming you can be a Wizard, oddly serene with the world falling down around you. You know. After all of the Modifications.", "points": 1, "CBMs": [ "bio_surgical_razor", "bio_adrenaline", "bio_alarm", "bio_armor_arms", "bio_armor_eyes", "bio_armor_head", "bio_armor_legs", "bio_armor_torso", "bio_batteries", "bio_blood_anal", "bio_blindfold", "bio_cable", "bio_blood_filter", "bio_carbon", "bio_climate", "bio_cloak", "bio_digestion", "bio_ears", "bio_emp_armgun", "bio_ethanol", "bio_evap", "bio_eye_optic", "bio_faraday", "bio_fingerhack", "bio_flashbang", "bio_geiger", "bio_gills", "bio_ground_sonar", "bio_heat_absorb", "bio_heatsink", "bio_infrared", "bio_laser", "bio_flashlight", "bio_leukocyte", "bio_lighter", "bio_lockpick", "bio_membrane", "bio_memory", "bio_metabolics", "bio_meteorologist", "bio_nanobots", "bio_night_vision", "bio_night", "bio_painkiller", "bio_power_armor_interface_mkII", "bio_purifier", "bio_radscrubber", "bio_recycler", "bio_remote", "bio_scent_mask", "bio_scent_vision", "bio_sleepy", "bio_solar", "bio_fuel_cell_gasoline", "bio_speed", "bio_sunglasses", "bio_targeting", "bio_tools", "bio_torsionratchet", "bio_tools_extend", "bio_uncanny_dodge", "bio_ups", "bio_watch", "bio_syringe", "bio_weight", "bio_taste_blocker", "bio_soporific", "bio_water_extractor", "bio_probability_travel",

    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII",
    "bio_power_storage_mkII"

     ], 

"skills": [ { "level": 50, "name": "barter" }, { "level": 50, "name": "speech" }, { "level": 50, "name": "computer" }, { "level": 50, "name": "firstaid" }, { "level": 50, "name": "mechanics" }, { "level": 50, "name": "traps" }, { "level": 50, "name": "driving" }, { "level": 50, "name": "swimming" }, { "level": 50, "name": "fabrication" }, { "level": 50, "name": "cooking" }, { "level": 50, "name": "tailor" }, { "level": 50, "name": "survival" }, { "level": 50, "name": "electronics" }, { "level": 50, "name": "archery" }, { "level": 50, "name": "launcher" }, { "level": 50, "name": "pistol" }, { "level": 50, "name": "rifle" }, { "level": 50, "name": "shotgun" }, { "level": 50, "name": "smg"}, { "level": 50, "name": "throw" }, { "level": 50, "name": "melee"}, { "level": 50, "name": "bashing" }, { "level": 50, "name": "cutting" }, { "level": 50, "name": "dodge" }, { "level": 50, "name": "gun" }, { "level": 50, "name": "stabbing" }, { "level": 50, "name": "spellcraft" }, { "level": 50, "name": "unarmed" } ], "spells": [ { "id": "summon_zombie", "level": 5 }, {"id": "smite", "level": 1 }, {"id": "recover_mana", "level": 1 }, {"id": "recover_pain", "level": 1 }, {"id": "summon_skeleton", "level": 1 }, {"id": "summon_decayed_pouncer", "level": 1 }, {"id": "dark_sight", "level": 1 }, {"id": "megablast", "level": 1 }, {"id": "create_atomic_light", "level": 1 }, {"id": "blinding_flash", "level": 1 }, {"id": "ethereal_grasp", "level": 1 }, {"id": "protection_aura","level": 1 }, {"id": "create_teleporter", "level": 1 }, {"id": "create_food", "level": 1 }, {"id": "translocate_self", "level": 1 }, {"id": "druid_veggrasp", "level": 1 }, {"id": "druid_rootstrike", "level": 1 }, {"id": "druid_woodshaft", "level": 1 }, {"id": "druid_naturebow1", "level": 1 }, {"id": "recover_fatigue", "level": 1 }, {"id": "summon_bear","level": 1 }, {"id": "fungicide", "level": 1 }, {"id": "purify_seed", "level": 1 }, {"id": "point_flare", "level": 1 }, {"id": "create_lighter", "level": 1 }, {"id": "ice_spike", "level": 1 }, {"id": "fireball", "level": 1 }, {"id": "cone_cold", "level": 1 }, {"id": "burning_hands", "level": 1 }, {"id": "frost_spray", "level": 1 }, {"id": "chilling_touch", "level": 1 }, {"id": "glide_ice", "level": 1 }, {"id": "hoary_blast", "level": 1 }, {"id": "ice_shield", "level": 1 }, {"id": "frost_armor","level": 1 }, {"id": "bless", "level": 1 }, {"id": "invisibility", "level": 1 }, {"id": "holy_blade", "level": 1 }, {"id": "spirit_armor","level": 1 }, {"id": "create_atomic_lamp", "level": 1 }, {"id": "recover_bionic_power","level": 1 }, {"id": "taze", "level": 1 }, {"id": "quantum_tunnel_lesser", "level": 1 }, {"id": "synaptic_stimulation", "level": 1 }, {"id": "laze", "level": 1 }, {"id": "animated_blade", "level": 1 }, {"id": "mirror_image", "level": 1 }, { "id": "necrotic_gaze", "level": 1 } ], "items": { "both": [ "jeans", "tshirt", "gloves_light", "hat_ball", "boots", "socks", "hoodie", "knit_scarf","cheat_belt", "wizard_utility", "black_dragons", "alchemy_basic", "necro_basic", "pyro", "wizard_advanced", "priest_beginner", "priest_advanced", "winter_grasp", "tome_of_storms", "lightning_storm_scroll", "generic_spellbook", "biomancer_spellbook", "druid_spellbook", "recovery_spellbook", "magus_spellbook", "eshaper_spellbook", "magus_spellbook_move", "summon_scroll_smudged", "summon_undead_spellbook", "techno_fundamentals", "techno_idiots", "techno_em", "translocate_spellbook", "stat_up_spellbook", "militarymap", "survivormap", "roadmap", "trailmap", "touristmap", "restaurantmap", "prussian_blue", "prussian_blue", "prussian_blue", "prussian_blue", "prussian_blue", "vitamins", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "mre_southwestbeef_box", "wizard_beginner" ], "male": [ "boxer_briefs" ], "female": [ "bra", "panties" ] }, "traits": [ "DRUID","KELVINIST","ANIMIST","TECHNOMANCER" ] },

Pmm5000 commented 5 years ago

Oh. I even went ahead and straight up turned off all mods.

image

Used this class from the base game and added a bunch of power storage. { "type": "profession", "ident": "bionic_prepper", "name": "Bionic Prepper", "description": "You knew the end was coming. You augmented yourself with some basic bionics and got additional survival training. Now the end has come, and it is time to see if your efforts have paid off.", "points": 6, "CBMs": [ "bio_metabolics", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_power_storage_mkII", "bio_tools", "bio_flashlight", "bio_lighter", "bio_evap", "bio_climate", "bio_taste_blocker" ], "skills": [ { "level": 4, "name": "survival" }, { "level": 3, "name": "fabrication" }, { "level": 3, "name": "cooking" }, { "level": 2, "name": "firstaid" }, { "level": 2, "name": "gun" }, { "level": 2, "name": "rifle" }, { "level": 2, "name": "melee" }, { "level": 2, "name": "cutting" }, { "level": 1, "name": "bashing" } ], "items": { "both": { "items": [ "hat_boonie", "tshirt", "gloves_fingerless", "pants_cargo", "socks", "boots", "trenchcoat", "knit_scarf", "backpack", "canteen", "smart_phone", "wristwatch", "binoculars" ], "entries": [ { "item": "crossbow", "ammo-item": "bolt_steel", "charges": 1, "contents-item": "shoulder_strap" }, { "item": "bolt_steel", "charges": 20, "container-item": "quiver" }, { "item": "machete", "container-item": "scabbard" } ] }, "male": [ "boxer_shorts" ], "female": [ "sports_bra", "boxer_shorts" ] } },

And I still have negative power. So I'm still left wondering if this is normal.

Aloxaf commented 5 years ago

Actually, it's 2147483647mJ. Related PR: https://github.com/CleverRaven/Cataclysm-DDA/pull/34288

Pmm5000 commented 5 years ago

I get that. But at the moment from the looks of the bionics in the bionics.json in the main file,

{ "id": "bio_power_storage_mkII", "type": "bionic", "name": "Power Storage Mk. II", "capacity": 250, "description": "A Compact Bionics Module that increases your power capacity by 250 units.", "flags": [ "BIONIC_NPC_USABLE" ] },

Capacity has been changed to a kJ change. Least in this version I updated to. I don't know if this is normal or not. Also, far too many bionics use kJ instead of mJ.

anothersimulacrum commented 5 years ago

So what you're asking for in this issue is that power for power storage bionics be defined in mJ instead of kJ?

KorGgenT commented 5 years ago

or better, use units::energy and strings

Pmm5000 commented 5 years ago

Well. realistically speaking, what I'm asking for is that

  1. My units for power don't go negative upon accidentally going past the limit that isn't indicated in an easily found place... assuming it can be found.
  2. If the change is made for power storage bionics is defined in mJ then I would want the active bionics to us mJ instead of kJ like they are now. Basically for the bionics to match what I have in power. Because quite frankly, 2000 or so kJ is no where near enough to play around as a metaphorical bionic god if the vast majority of bionics use kJ of power.
kevingranade commented 5 years ago

The most obvious fix for this is to validate power bionics on load and fail to load if they exceed the max power level.

Pmm5000 commented 5 years ago

That is indeed an obvious fix. However, I feel like the bigger issue here is that the energy limit is 2147483647 mJ which is 2147 kJ. Which I feel is crippling when coupled with the fact that every single active bionic is powered by kJ of power and even the power capacity upgrades do things by kJ of power. So wouldn't it be simpler to figure out how to change the mJ to kj? Thus increasing the limit to 2147483647 kj? Which is honestly a bit absurd. Like that's a nuclear power plant at that point. However, wouldn't it also fit the changes to the unit of power that most bionics use?

anothersimulacrum commented 5 years ago

34456

Pmm5000 commented 5 years ago

Oh. Hey. Thanks anothersimulacrum.

Fris0uman commented 5 years ago

My units for power don't go negative upon accidentally going past the limit that isn't indicated in an easily found place... assuming it can be found.

Is adressed by #34435, you can still overflow if you're using debug bionic install but otherwise it should be good

If the change is made for power storage bionics is defined in mJ then I would want the active bionics to us mJ instead of kJ like they are now. Basically for the bionics to match what I have in power. Because quite frankly, 2000 or so kJ is no where near enough to play around as a metaphorical bionic god if the vast majority of bionics use kJ of power.

Is adressed by #34456

Is there something else missing?

Pmm5000 commented 5 years ago

Realistically speaking, no there isn't anything else. This thread can be closed, but I do have one bit of curiosity. If I wanted to increase the power limit, how would I go about doing that?

On Sat, Oct 26, 2019, 2:17 PM Fris0uman notifications@github.com wrote:

My units for power don't go negative upon accidentally going past the limit that isn't indicated in an easily found place... assuming it can be found.

Is adressed by #34435 https://github.com/CleverRaven/Cataclysm-DDA/pull/34435, you can still overflow if you're using debug bionic install but otherwise it should be good

If the change is made for power storage bionics is defined in mJ then I would want the active bionics to us mJ instead of kJ like they are now. Basically for the bionics to match what I have in power. Because quite frankly, 2000 or so kJ is no where near enough to play around as a metaphorical bionic god if the vast majority of bionics use kJ of power.

Is adressed by #34456 https://github.com/CleverRaven/Cataclysm-DDA/pull/34456

Is there something else missing?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CleverRaven/Cataclysm-DDA/issues/34501?email_source=notifications&email_token=ACSDBXPLG55HAPHLQGCGE3DQQSJUNA5CNFSM4I52NQR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKPAFY#issuecomment-546631703, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSDBXKHCWHBIDXV4GU6XK3QQSJUNANCNFSM4I52NQRQ .

DeeUnderscore commented 5 years ago

You could try patching the game to use 64 bit integers for bionic power. #34431 did that, but it might not merge cleanly now (I haven't checked).