ConorMcPersonal / Toaster

The greatest ever Spectrum game based purely around the toast concept
Apache License 2.0
0 stars 1 forks source link

Add concept of thermal mass and aggregation #15

Closed ConorMcPersonal closed 1 year ago

ConorMcPersonal commented 1 year ago

Added thermalMass and thermalAggregation to both slot and bread. Slows down the heating process for both, making the game a bit more reasonable to play. Thermal mass will be important for the data-driven bread types.

thermalAgg generally starts at zero, then each loop it adds the temp difference to its environment on. Once thermalAgg reaches thermalMass multiplied by the max temperature, the temp is at the max (200) and so it can't rise any further. Similarly caps at zero the other end - once the agg is zero it won't find any environment colder.

Also got the "unit test" for slot working again (ie standalone compile), but this seems to indicate there's a problem with the moisture and toastedness bars in slot monitor. It may just be that I have screwed up the refresh logic though.

mcmenaminadrian commented 1 year ago

Adding: I don't really understand the thermal mass/aggregate stuff but you do, so I'm happy to go with that. Before we go the wrong way, though, maybe you could explain what you mean by "data-driven bread types"?

ConorMcPersonal commented 1 year ago

Data-driven bread types - right now we have code in control.c that turns characters (W, B, G) into "bread" (line 120 and below) with different characteristics.

Data driven bread types would be defined once in the code and that definition would have everything needed to instantiate that bread type. So likely a struct like this: struct BreadType { char letter; //letter associated with this type eg G char* name; //pointer to the bread name eg baGel int thermalMass; // eg 164 int moistureBase; //eg 100 - random moisture will be added as a % of this int scoreMult; // some number determining multiple things....see below }

On scoreMult, this could determine:

That code in control.c would then be looking for any letter in a BreadType definition, getting the data above and using it to initialize the Bread object