Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[READY] Battery overhaul 2 electric boogaloo #29651

Merged

Conversation

Inglonias
Copy link
Contributor

@Inglonias Inglonias commented Apr 16, 2019

Summary

SUMMARY: Balance "Overhauls how the game handles batteries"

Purpose of change

This is a complete overhaul of how battery powered tools are handled, with the intent of making that aspect of the game less abstract and more realistic.

Implements #29536

Describe the solution

All batteries are now magazine-style, and all tools that formerly accepted batteries now accept these magazines instead. You cannot unload or reload these batteries directly, but they do have the RECHARGE flag. There are 3.5 different categories of batteries, and they're detailed in the compatibility chart below:
image

Ultralight: Think of these as coin cell batteries. Used where size is important or the manufacturers are cheap bastards (which is why it's standard in the talking doll, for instance). Note that while tools in this category have batteries that are compatible with light tools, light batteries cannot fit into ultralight devices.

Light: Think of this like a smartphone battery. The high-capacity variant is a high-end one for consumer goods that need a bit more juice like professional camera equipment. Note that tools in this category can fit ultralight batteries.

Medium: These are equivalent to the batteries you'll find on modern cordless tools. The high capacity ones are for things like military-grade equipment (mess kits) and fancier electronics (L-sticks)

Heavy: These are car batteries in all but name. The high capacity heavy batteries currently only come standard on a UPS

Describe alternatives you've considered

The battery system as-is works well enough, but it's pretty abstract and has needed a serious upgrade for a while. Since electrical tools can already accept battery magazines no problem, this is the logical conclusion. This solution involves no new C++ code, only JSON.

Additional context

I made a light balance pass on any existing tools in the base game. I tried to keep things about the same in terms of overall performance, but this probably needs balance work before it can be merged. It also needs testing. If you find any places where batteries still spawn, let me know. There's no real rush on this PR, and I suspect that fully removing the old battery spawns will take a while.

What will happen to my existing games and any batteries I may have?
Good question! As far as I'm aware, you'll keep the charges and magazines will sprout.

Still, I realize this might be inconvenient for those of you with long-running games. For those, magazine-style batteries can be reloaded (but not unloaded). This will likely go away a few weeks after this PR is merged.

@ifreund ifreund added [JSON] Changes (can be) made in JSON Items: Battery / UPS Electric power management Items: Magazines Ammo holding items and objects. Mods Issues related to mods or modding Game: Mechanics Change Code that changes how major features work labels Apr 16, 2019
@Fris0uman
Copy link
Contributor

  • How does one recharge regular batteries ?
  • What's the difference between UPS and regular battery in this system ?

@darktoes
Copy link
Contributor

I like the sound of this, seems pretty well thought out, though it sounds like light and light minus type batteries shouldn't have the RECHARGE flag. I think they should remain the "disposable" type batteries. There's also the possibility of a disposable variant of the medium size battery, to model D/9V/Lantern batteries.

Sounds like the legacy batteries should still be reloadable by default, so those with ongoing games will be able to use up their legacy batteries without requiring the mod for a while.

@Amoebka
Copy link
Contributor

Amoebka commented Apr 17, 2019

So, let's say I have a soldering iron and three batteries (assuming it uses medium ones, irrelevant here) for it, medium(13), medium(24) and medium(7). Will I be able to craft a recipe that needs soldering iron (40 charges) under the current implementation? Logically, I should be able to, and preferably without manually clicking the tool reload button twice.

@ifreund
Copy link
Contributor

ifreund commented Apr 17, 2019

So, let's say I have a soldering iron and three batteries (assuming it uses medium ones, irrelevant here) for it, medium(13), medium(24) and medium(7). Will I be able to craft a recipe that needs soldering iron (40 charges) under the current implementation? Logically, I should be able to, and preferably without manually clicking the tool reload button twice.

Incremental charge consumption is coming up next in #29210 and will make that possible.

@Inglonias
Copy link
Contributor Author

Sounds like the legacy batteries should still be reloadable by default, so those with ongoing games will be able to use up their legacy batteries without requiring the mod for a while.

This is incorrect. You will need the mod immediately to use your legacy batteries.

@Inglonias
Copy link
Contributor Author

Inglonias commented Apr 17, 2019

How does one recharge regular batteries ?

...I don't actually know what the recharge flag does.
RECHARGE Gain charges when placed in a cargo area with a recharge station.
Oh. Ok. So I guess put it in a recharging box? I'll have to test this, but your point still stands. We need a way to recharge these batteries right from the get-go.

What's the difference between UPS and regular battery in this system ?

I guess the UPS is just a really fancy extra battery pack in this new system. Isn't that what it was before anyhow?

@darktoes
Copy link
Contributor

darktoes commented Apr 17, 2019

This is incorrect. You will need the mod immediately to use your legacy batteries.

I'm saying you should make it that way. People shouldn't be able to obtain more legacy batteries, but anyone with an ongoing save will likely have a bunch in storage and lots more lying around in houses and such. If you make it so the batteries can be loaded but not unloaded, then it can't be exploited, and anyone with an existing save is covered without needing to download a mod.

Tl:Dr Legacy batteries need "NO_UNLOAD" but should not have "NO_RELOAD". Then you don't need the mod.

@Human-Shield
Copy link

Magazines are a good concept. It would be great if "charge units" were real world measures like kwh and scale with vehicle power. Does the car battery mod still work for tools?

Need a way to charge without a UPS, should be doable with copper wires if you need to transfer charges over time between magazines (with % lost).

@Inglonias
Copy link
Contributor Author

Car battery mod should still work, yes.

One unit of battery already represents 1 kJ of energy.

Charging without a ups might require new C++ code, which I don't think is in scope.

@Zireael07
Copy link
Contributor

Good idea @Vasyan2006 but IMHO for a separate PR. This one is plenty big already.

@Inglonias
Copy link
Contributor Author

I agree. Those are definitely things to look at for a rebalance later. Not for this PR, though.

@paulenka-aleh
Copy link

If smartphones are going to have 30 charges their battery consumption should be revised too. I have 2500mAh battery and able to surf internet for 4 hours without caring about power saving. In-game cellphone on-screen flashlight uses up 10 charges every 30 minutes.

I suppose it's valid for all the other tools.

@thiagoshima
Copy link
Contributor

Charge capacity for items was set before the introductions of 1 charge = 1 kJ rule and it can be very arbitrary. Imho based on irl batteries for different items this chart should be:
Ultralight - mp3 players and game watch: 10 charges
Light - smartphone - 30 charges,
Medium (2x NiMH C battery) - flashlight - 45 charges,
Heavy (2x NiMH D battery) - HD flashlight - 90 charges,
Heavy+ - cordless drill - NiMH batteries - up to 110 charges from this link
https://www.amazon.com/Battery-Packs-Drill-Chargers/s?rh=n%3A552354%2Cp_n_feature_keywords_browse-bin%3A5909259011

Nonchargeable alkaline batteries have much higher capacity compare to Li-Ion or NiMH, but they are obviously single use items. 40 charges in the last post was for alkaline C battery.

Hotplates, jackhammers, kilns and forges can easily consume 1 kW (6 charges every turn) of power and should use vehicle storage batteries with preinstalled vehicle adapter.

UPS is crafted from the small storage battery and should have the same capacity.

This change can make many items unusable until their power consumption will be recalculated in Joules. So maintainers must decide about implementing these changes now or in separate PR.

One thing to note is that the game happens in 2050, from now until them the battery tech could have advanced.

@Inglonias
Copy link
Contributor Author

Inglonias commented Apr 24, 2019

One thing to note is that the game happens in 2050, from now until them the battery tech could have advanced.

I'm not going to use that as an argument. Currently, batteries are balanced around lighter tools having roughly 100 charges and I'm not going to mess with that in this PR. If someone wants to implement Vasyan's numbers later in a balance pass, great. I'll happily help them if they need it. For now, I'm not going to affect balance that much if I can avoid it.

@Night-Pryanik
Copy link
Contributor

One thing to note is that the game happens in 2050

No, it's not. Actually it's present time, maybe plus-minus a few years.

@adamkad1
Copy link
Contributor

plutonium cells stay as normal?

@egorzaderiy
Copy link
Contributor

UPS mod can't be attached to pre-patch tools. Is this deserves issue?

@l29ah
Copy link
Contributor

l29ah commented Apr 26, 2019

Ok now my survivor headlamp doesn't consume batteries but works, cool.

@adamkad1
Copy link
Contributor

you know, this should probally be a separate mod untill everything is done, because its way more work than they think it is

@Night-Pryanik
Copy link
Contributor

It's not a good idea for project to present feature that will be mainlined eventually in form of a mod. People might not be wanting to activate this mod, so we don't get a feedback for new mechanics.
For those who don't want to test new mechanics, there is a mod that reverts this change back to old batteries.

@adamkad1
Copy link
Contributor

adamkad1 commented Apr 28, 2019

there is? where?

Also you should buff ups charger, its PATHETIC and since everything is gonna use it now...
Or add a new kind of recharger
(also on opinion side, i think people who willingly take things that are unfinished are more effective at finding errors than random people)

@Night-Pryanik
Copy link
Contributor

@Inglonias
Copy link
Contributor Author

also on opinion side, i think people who willingly take things that are unfinished are more effective at finding errors than random people

There was not one but TWO threads on Reddit asking for review. If you wanted to test it, you had every opportunuty.

@adamkad1
Copy link
Contributor

also on opinion side, i think people who willingly take things that are unfinished are more effective at finding errors than random people

There was not one but TWO threads on Reddit asking for review. If you wanted to test it, you had every opportunuty.

do i look like a person who uses reddit?

@adamkad1
Copy link
Contributor

there is? where?

https://github.com/CleverRaven/Cataclysm-DDA/tree/master/data/mods/Battery_Migration

thats just reloading batteries with legacy cells, doesnt help for stuff that pop errors because invalid mag. guess ill hang off playing the game

@kevingranade
Copy link
Member

do i look like a person who uses reddit?

Entitlement level and bad idea quotient checks out, yea.

@CleverRaven CleverRaven locked as resolved and limited conversation to collaborators Apr 28, 2019
@Inglonias Inglonias deleted the battery_overhaul_2_electric_boogaloo branch May 1, 2019 16:45
@Inglonias Inglonias restored the battery_overhaul_2_electric_boogaloo branch May 1, 2019 16:46
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/how-to-recharge-the-new-battery-cells/20081/2

@I-am-Erk
Copy link
Member

Hey there. I'm working on plutonium cells and came across the "atomic" battery. What is this meant to be? It shows up in a lot of places and has limited charges, which doesn't seem to make sense with atomic.

@Inglonias Inglonias deleted the battery_overhaul_2_electric_boogaloo branch September 23, 2020 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Game: Mechanics Change Code that changes how major features work Items: Battery / UPS Electric power management Items: Magazines Ammo holding items and objects. [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding
Projects
None yet
Development

Successfully merging this pull request may close these issues.