Topic on User talk:Cheldra

Jump to navigation Jump to search
Harakoni (talkcontribs)

Just wanted to say that all the work you've been doing on updating the animal stats has been noticed and is appreciated

If need any help with anything, I'm a mod around here so don't hesitate to ask!

Cheldra (talkcontribs)

Thank you! If possible, I'd like to add a few new animal stats such as juvenile age and expected litter size, so I might ask for your help when it comes to that.

Harakoni (talkcontribs)

Sure! Atm there is Property:Offspring Per Birth which is set using "|offspring =" in the infobox which shows the range of litter sizes (e.g. 1-3), but if you're keen to add/update it to include a specific average then that can absolutely be arranged. I do know that there is a size curve for each litter, so implemenation can be done a few ways. Flat inputting a number for the average (e.g. |avg offspring = 1.5) is easy and will take like 30 seconds, but having the infobox calculate the average itself from the curve's points is much more involved and will take a bit of work when I'm free to do it properly.

Just lemme know what needs to be changed/how you want it and I can see about implementing it.

Harakoni (talkcontribs)

Same goes for juvenile age if that wasn't clear - lemme know how you want it implemented and I'll see about it when I can

Cheldra (talkcontribs)

I've written a script to calculate the expected litter size from the size curve, so a flat input would be great. In total, all of the fields that I would ideally like added would be:

- expected_litter_size (flat)
- juvenile_age (flat)
- juvenile_hunger = 0.75*real_hunger_rate
- juvenile_size = 0.5*body_size
- juvenile_meat = 140*juvenile_size (flat input for values under 40)
- juvenile_leather = 40*juvenile_size (flat input for values under 40)
- baby_hunger = 0.4*real_hunger_rate
- baby_size = 0.2*body_size, other than birds in which case 0.1*body_size
- baby_meat = 140*baby_size (flat input for values under 40)
- baby_leather = 40*baby_size (flat input for values under 40)

I'm not sure if all of these should be displayed in the infobox, but they would be useful for a ranching efficiency table that I would like to do.

Harakoni (talkcontribs)

We can set properties even if they're not displayed, but in cases like juvenile hunger you could also just use do the calculation at the point of use, e.g. having the ranching efficiency table do the calculation using the existing property. Also do you have specific examples of when the under 40 values are used?

Unfortuantely I have to head off for now, but feel free to keep posting any specifics and anything else you think of. In the meantime, avg litter size implemented as "|avg offspring =" and Property:Average Offspring Per Birth for consistency reasons. Will display in brackets next to the litter size range currently in the infobox e.g. = 1-2 (1.5 avg).

Cheldra (talkcontribs)

Thank you for implementing the average offspring! I'll get to work filling it right away.

Meat and leather yield all go through a post processing curve with points (0,0), (5,14), (40,40), (100000,100000) defined in Data/Core/Defs/Stats/Stats_Pawns_General.xml, which effectively increases values below 40. For example, baby ducks would have a meat yield of 0.03*140 = 4, but the post-process curve increases it to 12.

I don't know how possible it would be to implement the curve within the wiki, but if it is straightforward, here's my python function in case it's helpful:

def post_process_curve(pre, x=[0, 5, 40, 10000], y=[0, 14, 40, 10000]):
	for i in range(len(x)):
		if pre < x[i]:
			gradient =  (y[i] - y[i - 1])/(x[i] - x[i - 1])
			progress = pre - x[i - 1]
			return y[i - 1] + gradient*progress
Harakoni (talkcontribs)

Instead of {{#show:{{PAGENAME}}|?Daily Milk Average#}} you can also just use {{P|Daily Milk Average#}} - its basically the same method and either is perfectly fine, you just might find it more convenient when editing.

Cheldra (talkcontribs)

Thank you, that's good to know :)