C7-Game / Prototype

An early-stage, open-source 4X strategy game
https://c7-game.github.io/
MIT License
34 stars 9 forks source link

189 display roads #312

Closed Kright closed 2 years ago

Kright commented 2 years ago

Add layer for rendering roads and railroads. Add a few roads at top left corner of c7-static-map for demonstration. Movement costs weren't touched, roads just displayed.

Closes #189 Closes #190

QuintillusCFC commented 2 years ago

Oh, one thing. I noticed this is linked to #190, but it appears that while it adds support for BIQs/JSON saves, it doesn't for SAVs yet. Which is okay, that was always intended as the next step. Just wanted to confirm that we should leave #190 open but note that it's just SAV support that remains.

Kright commented 2 years ago

it appears that while it adds support for BIQs/JSON saves, it doesn't for SAVs yet.

I added roads to QueryCiv3.Sav, but didn't tested. Or you mean something else?

QuintillusCFC commented 2 years ago

it appears that while it adds support for BIQs/JSON saves, it doesn't for SAVs yet.

I added roads to QueryCiv3.Sav, but didn't tested. Or you mean something else?

So you did... so I dug into it more why it wasn't showing up. TILE in the SAV structure is more complex than in the BIQ, and it looks like the place you added it would work for Vanilla and PTW, but not for Conquests.

Below the area where you added it, there is this section:

        // if civ 3 conquests file (for now we'll assume this is always true)
        private fixed byte HeaderText2[4];
        public int Length2;

        // TODO: Most flags need to be added
        private fixed byte Flags2[12];

Based on the notes I have from a private Civ forum, Flags2 contains:

   OverlayBits      4            12         Overrides TILE#1 OverlayBits.
   Unknown          1            13            
   TerrainBits      1            14         Split in two nibbles for real and base. Overrides TILE#1 TerrainBits.
   Unknown          2            16            
   BonusBits        4            20         Overrides TILE#1 BonusBits.

Whereas Flags1 contains:

Unknown          2            24
OverlayBits      1            25           See TILE#2 for c3c.
TerrainBits      1            26           Split in two nibbles for real and base. See TILE#2 for c3c.
BonusBits        1            27           See TILE#2 for c3c.
RiverData        1            28

What is present right now is Flags1[2], index 0 and 1, which is correct for PTW/Vanilla. I believe this means that Flags2[0], index 0 and 1, are what is required for Conquests. It definitely should be tested with a SAV file that has some roads built after the scenario starts, since I am not sure that any open-source project has implemented this before.

(As a side note, while I've shared the SAV structure info I have via e-mail with some of our collaborators, we haven't yet found a place to store it for project members)

Kright commented 2 years ago

I loaded civ3, build city with the road near it, saved as .sav and opened it from C7. Map hasn't city, but road exits)