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

Changed windchill model [WIP] #9593

Merged
merged 9 commits into from Nov 2, 2014

Conversation

Projects
None yet
10 participants
@Shoes01
Copy link
Contributor

commented Oct 18, 2014

I've decided to change the windchill model based on this forum post : http://smf.cataclysmdda.com/index.php?topic=8002.msg184741#msg184741

There is a bug in my code that I am blind to : windchill always turns "1" ??? I don't understand why. Hoping someone with C++ experience could point it out.

This PR also adds a debug item, the pocket meteorologist, which simply messages the player the absolute temp, pressure and humidity. Once the windchill=1 bug is fixed, I can remove the item if necessary.

@Robik81

This comment has been minimized.

Copy link
Contributor

commented Oct 18, 2014

I posted in mentioned thread, but I put it here too

I think that felt temp is partly bullshit though.
Real vs. felt

  1. Wind cannot get you colder or warmer than it is temperature of air itself, no matter how fast it is. It just cools you / warms you faster.
  2. This effect works on naked skin, but I doubt it's full effect work thru several layers of clothing, especially if it is clothing like raining coat or other non-breathable materials.

I would prefer, if instead of showing felt temperature, UI showed real temperature, wind speed and humidity estimates (based on survival?) and having weather gadget to show precise values. Similar to like time and watches works.

/// Source : http://en.wikipedia.org/wiki/Wind_chill#Australian_Apparent_Temperature
int windchill = (0.33 * ((humidity / 100.00) * 6.105 * exp((17.27 * Ctemperature)/(237.70 + Ctemperature))) - 0.70*tmpwind - 4.00);
// Source : http://en.wikipedia.org/wiki/Wind_chill#Australian_Apparent_Temperature
tmpwind = (float)(tmpwind*0.44704); // Convert to meters per second.

This comment has been minimized.

Copy link
@BevapDin

BevapDin Oct 18, 2014

Contributor

I get windchill of -1 up to 8 (temperature=23, humidity=86, windpower=0 or similar) during the first day.

The cast to float here is most likely not what you want, at least not needed (the involved values are already double).
Also the cast to int when return the value is not needed. The return value is per function declaration an int and is automatically convert to.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Oct 18, 2014

It might be reasonable to put wind/humidity/etc estimates somewhere, but not on the main interface, there simply isn't enough room.

@@ -5448,6 +5448,11 @@ void game::draw_sidebar()
wprintz( w_location, col_temp, " %s", print_temperature( display_temp ).c_str());
wrefresh(w_location);

// Debug items

This comment has been minimized.

Copy link
@kevingranade

kevingranade Oct 18, 2014

Member

If this is going to stick around, I'd far rather it have an iuse method that outputs to the log when active or something.
The sidebar is already complicated enough without adding debug features to it.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Oct 18, 2014

While you're looking at this, is there anything that makes clothes block wind?
If you're wearing a jacket, you should get some benefit from the jacket trapping heat, and some more from it lessening windchill. In the extreme case, you should be able to suit up enough to block windchill entirely (but we're talking arctic levels of gear)

@Robik81

This comment has been minimized.

Copy link
Contributor

commented Oct 18, 2014

Is it possible to have tooltip on UI elements? Like, if you hover on temperature showed in UI, it would show additional info like wind and humidity in tooltip?

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 18, 2014

@BevapDin I will try that out and see what happens, thanks!

@kevingranade I like your suggestion of having it display the information only when active; I'll likely do that. On the note about clothes that blocks wind : player::get_wind_resistance() does that; if you're wearing leather, plastic, bone, chitin or nomex you are blocking wind at 90%. Cotton is 70% and wool is 60%. Anything else is 99% effective.

@Robik81 On the note of informing the player/UI, maybe I could add a warning message like "your is doing little to protect you from these high winds!" when the windchill is lowering temps by more than 10 degrees or something. Now that I've typed it out, I think I will do that.

Thanks for checking it out gang!

@Robik81

This comment has been minimized.

Copy link
Contributor

commented Oct 18, 2014

Interesting, I should have 90% protection then... I don't know how following was even possible, unless I was fine but showed temperature suggested that I will likely freeze to death.

2nd day of spring
Lightning storm
Raincoat on
Wet morale -3
Inside building +3 °C
Outside building -19 °C

Maybe main problem isn't how weather system works but how it is interpreted by players, because UI is confusing?

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 18, 2014

The number on the UI is as if the player is naked; it's what you would feel on your face. I agree that part of the problem is communicating to the player what is happening. That's why I opted for relative UI temp (because the survivor can't really infer the absolute air temperature), and I show absolute body temperature in a @ menu. Adding a warning message for wind chill will clear a lot of this up I think.

@Robik81

This comment has been minimized.

Copy link
Contributor

commented Oct 18, 2014

I think if that is the case, temperature should be described as a word, because when it is specific number, like -19 °C everyone assumes it is precisely -19 °C, not that it feels like -19 °C

Edit: especially if it is how he would feel if naked, not in his current clothing...

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 18, 2014

@kevingranade thoughts on what Robik81 is saying? Shall I convert the number to words, as per most other things in the game?

@Shoes01 Shoes01 changed the title Changed windchill model [CR] Changed windchill model [WIP] Oct 18, 2014

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 18, 2014

Sadly, the wonky windchill reading was due to me putting in the metric model, not the imperial :x

I will look to move the pocket meteorologist to the iuse section.

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 18, 2014

I also fixed going backwards in cars creating "negative wind" that warms the player up, as noted by a user in the forums!

@i2amroy

This comment has been minimized.

Copy link
Member

commented Oct 18, 2014

I think I'm with Robik81 here. Make it into words if at all possible, then maybe have a thermometer item (could probably include the function in some other things, like power armor helmets) that would switch it over to displaying the exact temperature. (Maybe have a similar thing for the wind, where it gives a wind speed indicator in words that can be converted over to an exact value with the proper item available.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Oct 19, 2014

Yeah, remove the number altogether unless you've got the meterological debugger/CBM. The Comfortable/Chilly/etc suffices for felt.

(Perhaps the Fancy Watch could include temp?)

@kevingranade

This comment has been minimized.

Copy link
Member

commented Oct 19, 2014

Yea I'd prefer that, plus reporting the 'worst' temperature felt rather
than ignoring things that mitigate windchill.

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 19, 2014

Okay this got a little complicated fast ;p

  1. Remove the temperature value altogether, because the "Comfortable (Rising!)" is already doing it's job.

  2. Create a iuse function that will display windspeed, temperature, humidity, and felt-air temperature. Have different items be able to access it. Those items should include: power helmet, CBM, cars, radios, new thermometer, new hygrometer, new barometer, certain electronics (like watches, maybe others?).

In my mind, all of the items listed in 2) would simply print data in the log the way my debug item does now, not display temperature on the UI. However, should the temperature be displayed on the UI when you're in a car, or power helmet, or other "display" items?

@KA101

This comment has been minimized.

Copy link
Contributor

commented Oct 19, 2014

Printing to the UI gets spammy if it happens regularly. Better to have the temp show in the UI. Barometer and hygrometer might be check-on-demand and print to the UI.

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 19, 2014

Power helmets display temp, so does the new "digital watch" item. Are there any other items you can think of that should display the temp on the UI?

I am going to make the rest of the items check-on-demand style. I also don't play on having items display humidity or windspeed or windchill or any of that on the UI.

@Robik81

This comment has been minimized.

Copy link
Contributor

commented Oct 19, 2014

Internal chronometer CBM ?

@KA101

View changes

data/json/items/armor.json Outdated
"volume" : 1,
"material_thickness" : 0,
"storage" : 0,
"description" : "A simple digital wristwatch on a plastic band. Tells the time, has an alarm clock feature and displays the air temperature.",

This comment has been minimized.

Copy link
@KA101

KA101 Oct 19, 2014

Contributor

I presumed the wristwatch was digital thanks to the alarm clock. Mechanical watches generally lack that feature. Reason I suggested the Fancy Watch get a thermometer is that it seemed like the sort of thing that would have all sorts of whacked-out indicators. IMO, no need for a new item here.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Oct 19, 2014

I don't think anything should stick actual weather readings on the UI, if you need an exact readings, trigger the item to have it output readings to the log.
This is simply an issue of how much stuff can fit on the UI, there's already an indicator that tells you if you're in jeopardy, which is all you need for every turn, precise readings can be on-demand. It was super simple to switch back and forth with the time display, but I don't think that fits here. (literally, it doesn't fit)

Temperature is arguable, but at that point, don't we actually lose the "are you comfortable" reading?

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 19, 2014

Sounds good, in that case I will remove the digi watch, and make the power helmet read out data the same way the CBM will. The watch will also read out data, but only temperature. I will make a generic function to do that.

Also the "Comfortable (Falling!!)" stuff is always present. It has it's own line on the UI (I snagged that real estate last year!), and the actual temperature display is on the same line as weather. I would post a screenshot, but I am at work!

@Shoes01 Shoes01 force-pushed the Shoes01:windchill-change branch to 3b9664e Oct 22, 2014

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 22, 2014

I rewrote the history of the commits to remove the digi watch, that saved me time. I've added the code that allows the CBM to read the weather; I am not very creative when it comes to that stuff, so it's pretty bland. I would appreciate suggestion of things that would add a little flair to the CBM.

This CBM is mostly my proof of concept. I mentioned writing generic functions to read the weather, but it's probably not worth it. Plus, each item might have it's own string. Fancy watch only reading temperature, basic power helmet not reading windchill, etc. Let me know if this is not the way to proceed!

Like I said, I will allow the player to 'a'ctivate certain items (watch, helmets, new items specific to reading weather) to get a read on the weather.

Here is a screenshot of what the CBM prints out : http://i.imgur.com/NV70Fe9.png

Walking around a bit, I notice that my "warning, you are not wearing enough wind resistance" prompts are spammy and weird; I need to add a body part to the description, without it the warnings sound contradictory.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2014

I love the CBM idea.

@jcd000

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2014

i like the CBM output too.

one nit: i have seldom seen wind measured in km/h (though i don't know what they do in other parts of the world)
anyway, i usually (weather forecast) see it in the Beaufort scale, and between scientists they usually measure in m/s.

would it be possible to add an option in options menu for selecting between km/h, m/s, or Beaufort?
(maybe also mph if its common in the US?)

tbh, i'd just be ok with km/h as long as the Beaufort reading is also shown.
Eg: "Wind Speed: 56km/h / 7 Beaufort."

@kevingranade

This comment has been minimized.

Copy link
Member

commented Oct 22, 2014

I'd really prefer not to have an option for something so specific.
If m/s is common, that's fine, but I'd really like to limit it to imperial
vs metric so it can use the existing option.

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 22, 2014

I can easily make the km/h option read m/s for wind, if that's preferred. I hear m/s in science, but I hear km/h in weather forecasters more often.

@jcd000

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2014

as i said, since we live in different parts of the world, our experiences are bound to be different.
wanted to put it for debate though.
I mean, most people are used to m/s, km/h, mph or Beaufort?
I personally find Beaufort easier.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2014

I'd prefer m/s and Beaufort.

@illi-kun

This comment has been minimized.

Copy link
Member

commented Oct 23, 2014

Russia votes for "m/s" (and yes, I'm responsible for whole country, sorry, Vitaly:).
BTW, we need to talk about pressure units as well, since Pascals are for geeks/scientists/engineers only here (if we need to be so region-specific).

@Mshock777

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2014

@illi-kun Nice :)
I would've used something like kgf (or newtons) per m^2, but pascals are probably good for atmospheric pressure.

@jcd000

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2014

Bar or Pascal are fine by me for pressure.
Probably Pascal though...

@kevingranade

This comment has been minimized.

Copy link
Member

commented Oct 23, 2014

I don't care what the units are, I just want them to be either:

  1. Set by the existing imperial/metric option.
  2. Set by locale.

Shoes01 added some commits Oct 27, 2014

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 27, 2014

Eh, running into undefined references with my print_* functions, despite them being almost identical to print_temperature... anyone able to offer some insight?

@BevapDin

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2014

Declaration: std::string print_pressure(float pressure, int decimals = 0); float
Definition: std::string print_pressure(int pressure, int decimals) int

Same with the other two functions. "being almost identical" is not enough. You declare one function (with 1. parameter being a float), than you declare and define another function of the same name but with an int as 1. parameter. Those are two different function.

The first function is used by your code because you call it with a float as parameter. But you never implement that function, so the linked complains that it can not find that function.

@Shoes01

This comment has been minimized.

Copy link
Contributor Author

commented Oct 28, 2014

Thanks! I knew it was something simple, but man those are the hardest to find.

@KA101 KA101 force-pushed the CleverRaven:master branch from a342a64 to 0da0595 Oct 30, 2014

@kevingranade kevingranade merged commit 637ee17 into CleverRaven:master Nov 2, 2014

1 check failed

default Unmergeable pull request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.