Repository navigation
Added Goody Huts - #1100
Added Goody Huts#1100zack-the-coding-actuary wants to merge 4 commits into
Conversation
| }, | ||
|
|
||
| city = { | ||
| -- From the decompiled code: only civs with the Expansionist trait get |
There was a problem hiding this comment.
Let's keep comments to the point and decompilation references out of the codebase.
| "capacity": 0, | ||
| "hpBonus": 0, | ||
| "flags": [ | ||
| "allTerrainAsRoads" |
| -- TODO: Add proper replacement for the asset | ||
| c7_textures.terrain.river_delta = "Art/Terrain/mtnRivers.png" | ||
|
|
||
| -- TODO: terrain.goody_hut uses Art/Terrain/goodyhuts.png, which must be a |
| } | ||
|
|
||
| if (tile.hasGoodyHut) { | ||
| // Loaded on demand rather than in the constructor: standalone mode |
| LethalSeaBombardment, | ||
| Radar, | ||
| Wheeled, | ||
| AllTerrainAsRoads, |
| if (prto.LethalSeaBombardment) prototype.flags.Add(SaveUnitPrototype.Flag.LethalSeaBombardment); | ||
| if (prto.Radar) prototype.flags.Add(SaveUnitPrototype.Flag.Radar); | ||
| if (prto.Wheeled) prototype.flags.Add(SaveUnitPrototype.Flag.Wheeled); | ||
| if (prto.AllTerrainAsRoads) prototype.flags.Add(SaveUnitPrototype.Flag.AllTerrainAsRoads); |
| } | ||
| } | ||
|
|
||
| // Pop a goody hut. Barbarians never pop huts. |
There was a problem hiding this comment.
Can barbs even enter the goody hut tile?
There was a problem hiding this comment.
They cannot (I just verified in the regular game) but didn't want to also mess with barb pathfinding logic since I'm already updating so much with this PR. I'll stub a TODO and that could be a good first issue.
| } | ||
| } | ||
|
|
||
| // Civ3's "Treat all squares as road" ability (the Explorer in the base |
There was a problem hiding this comment.
"all terrain as roads" is the name of the ability flag, and this is true according to the reference
| // The Lua behaviors of the game mode, used by the map-generation steps | ||
| // that are scripted (e.g. goody hut placement). Those steps are skipped | ||
| // when this is null. | ||
| public BehaviorEngine behaviors; |
There was a problem hiding this comment.
I think we need a better mechanism than smuggling the behaviours in via WorldCharacteristics.
There was a problem hiding this comment.
I think we can cook up a EngineStorage.behaviours in SaveGame.ToGameData(..), etc.
|
Still thinking on how to approach this one since you described using decompilation. Can you assure us that it was only to confirm the spec and no code/algorithm was reused? Ideally even if we allowed this the documentation would be passed off to someone else to produce the code. Please do remove any references to decomp at least, and IMO even the explanations of the default rules are not necessary. Yes we should check with Kyriakos about using his huts. |
- Place huts at the end of map generation from Lua (goody_huts.placement), seeded from the map seed; none when barbarians are off - Huts are a terrain improvement overlay (Layer.GoodyHut), saved, loaded and imported from Civ3 SAV/BIQ files like barbarian camps, and drawn only where the player has seen them - Pop a hut when a non-barbarian unit enters it; the outcome table, preconditions and effects (gold, maps, city, settlers, mercenaries, tech, barbarians, nothing) live in Lua (goody_huts.pop) behind GoodyHutContext - Popped huts disappear from every player's map - Add a global RNG(n) for gameplay Lua backed by GameData.rng - Add the allTerrainAsRoads unit flag (movement not wired up yet) and Tile.ManhattanDistanceTo - Standalone mode has no hut art yet - Add placement and popping tests Tested in-game with expansionist and non-expansionist civs on different difficulties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f803bd4 to
3ef6fe9
Compare
…ngleton rather than through WorldCharacteristics Will allow for Lua logic to expressed more broadly across all game logic in one place.
- Popping a hut sends MsgGoodyHutPopped (player, tile, outcome, text), Lua passes the outcome name to context:Notify - Tech shows a blocking popup with the happy Science advisor, every other outcome shows a message above the hut, with a one-second pause before the next unit is selected - When the camera would have to jump to reach the next unit, pause half a second first. Selecting a unit or pressing W skips the pause - Don't auto-select while a modal is open or engine messages to the UI are still queued, so the next unit is picked after the player has seen what happened
- After borders are recomputed (founding a city, cultural expansion, city destruction), any hut on a tile a non-barbarian civ owns is popped for that civ; loading a save never pops huts - PopHut and GoodyHutContext accept a player with no unit for these border pops; the explorer check handles a missing unit - Measure hut distances with the existing Tile.DistanceTo ((|dx| + |dy|) / 2, so every adjacent tile is 1 away) and remove ManhattanDistanceTo. Logic verified against base game calculations. - Test that a city founded next to huts, Expansionist or not, never gets barbarians or a city from them
|
Alright I think I addressed everything above and added a few quality of life changes while I was testing the game:
|
This is a bit of a doozy PR so all good if we have pending changes for a while. I WAS thinking of adding a barbarian overhaul to this one too but after seeing how much I already changed...I figured do that separate lol.
Addressing issue #934
The meat and potatoes of this update lives in the new goody_huts.lua file I added which gives full customization to goody hut popping behavior and probabilities, though I can put this in ruleset.json if more appropriate. I also set up a helper on the C# side to pull random numbers from the
GameDatarng field, buuuut I'm not seeing that it's able to reproduce the same pops, so that might be a TODO if important to be able to preserve random seed. The default settings in the lua file match regular Civ 3 (to the best of my ability between what's online and what I was able to decompile).Citation from deep tribal knowledge here
Also have my Ghidra dump notes in #934 which confirm those numbers.
I tested this with a few expansionist and non-expansionist civs across different difficulties and I'm getting the pops I would expect to in each scenario. I have NOT yet tested whether this loads goody huts properly from Civ 3 saves, though I did wire it up.
Note that I have NOT yet requested to make a PR for a placeholder goody hut asset (for the standalone mode). I think running in standalone will crash but haven't tested as I used my own AI placeholder for now.
Version made by Kyriakos, I updated to PNG and removed colored background (poorly), should ask permission to use.
SlopHutTM
Lmk what you all think!