Skip to content

Districts #3

@instafluff0

Description

@instafluff0

@maxpetul , I'm a huge fan of your work with C3X, and as many others have said, thank you!

Basically, I'm interested in creating a mod based on C3X (fork here) which adds "districts (light)", or essentially the visual elements of districts from Civ 6 (literally, as tiles on the map), only without adjacency bonuses or anything like that. So a building like barracks would require having an encampment district within a city's radius, etc.

Let's please leave aside for now whether this is a good idea and a million-and-one other details about gameplay I need to figure out. Long-story-short, I tried really hard to enjoy Civ 6, and loved the urban sprawl look, but in terms of gameplay nothing has been as fun as Civ 3. So trying to make a happy marriage of the two...

Visually, something like this:

Image

I've reviewed the repository extensively as best I can, and also familiarized myself with Ghidra and analyzed the exe code and confirmed I can see the correspondence with the gog mem addresses in civ_prog_objects.

I have a number of questions though that I hope won't be too onerous, and that you can point me in the right directions and teach me how to fish. Thank you in advance for any guidance you can provide 🙏

How a district would be built

I'm thinking workers (not cities) would build a district as an additional action. So for example:

  1. Worker moves to flat terrain tile within radius of city
  2. Additional button shows up in actions, like 'Build Encampment' or 'Build Neighborhood', which each take 10 turns for one worker (districts available will have dependencies on a tech)
  3. 10 turns pass
  4. District pcx image shows up on improved tile
  5. Cities for which district are in radius are now able to build barracks, for example
  6. I haven't yet decided if a district could still be 'worked' by the city, and what yields they would offer, as they'd need to somehow offset the loss of potential mines, irrigation, etc.

Obviously there are many details and checks involved that I'll need to figure out, but I'm trying to conceptually keep it simple for now. Also, as you can see in the example image, I'm thinking of re-using the city pcx art for a given culture & era as the 'Neighborhood' art. Others I'll make new pcx files for.

Questions

  1. I need to add a worker job for this to the Worker_Jobs enum, but also any idea
    • Where I could set the cost per turn? (ie, to make it take 10 turns)
    • Where to set the dependency between an improvement and a given tech?
    • Where to set the yield value of a given improvement (i.e., how yield would be calculated for a given terrain with a district improvement)
  2. I assume I would need to implement something like init_stackable_command_buttons and related functions, but I'm unclear on the relationship between the dimensions & number of images in pcx files and the params that go into Sprite_slice_pcx, e.g., Sprite_slice_pcx (sprite, __, pcx, 0, 0, 64, 32, 1, 1);.
  3. What function(s) draw the terrain improvement images on tiles?
  4. What function(s) determine buildings a city can build? I'm assuming I'll need to intercept or rework that to take districts in city radius into consideration.

Sorry for the long post. Any pointers you have about how you'd approach this (like, a step-by-step laundry list of how you would approach this would be amazing) and in particular how to work with pcx images (tutorials in Civ fanatics tend not approach this from a code perspective, so seem less helpful), would be greatly appreciated. Thank you again in advance.

Edit: Thinking about this a bit more, I'm wondering if the approach you take with set_up_stack_worker_buttons, specifically this loop could be adapted to intercept and add the Build Encampment, Build Campus, etc. buttons at runtime, rather than formally adding as worker job types and so on. Is this what you'd recommend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions