Cultural Variation for Improvements

Ulixes

Prince
Joined
May 2, 2010
Messages
312
Hi everybody. I Hope someone can help me.
I wish to add cultural variation for improvements like R.E.D. did for Units.

I already have the art files, all I need is a way to make an improvement change his graphic for a different civ.
I'm building a Chateau-like improvement, and I find weird to see a classic european art in china, aztec or polynesia. I'm planning to add cultural variation for forts too.

Note that it can't be done creating civ-specific improvements. If the civ has already two unique buildings/units, the game will crash! (besides, handling 43 unique improvements can be tricky)

I hope someone of you knows how to do it or find this idea interesting enough to try to figure out how to do it.

Thanks in advance for your time.
 

Ulixes

Prince
Joined
May 2, 2010
Messages
312
Thank you bane_, but I don't think it will work. I don't think the problem is the UI (that whoward mod fix).

I tested it extensively:
for some reason, after two uniques are already set, if you add an unique improvement, you won't be able to build not only that improvement, but also any other improvement that uses custom art (workers never finish it, always same amount of turns left).
If you try to place it with IGE, the game crashes.

Even if the UI was really the problem, I already passed 10 uniques per civ (whoward mod allow 6).
I don't need them to be displayed in the UI, as my uniques are only a workaround for GP names (in fact, I'm looking for a way to not display uniques at all).

The best solution would be a cultural variation feature like Gedemon did with units in R.E.D., and I'd really appreciate some help with it. Thank you anyway.
 

DarkScythe

Hunkalicious Holo
Joined
May 6, 2014
Messages
804
I'm not quite sure I understand what the problem is, with regard to "maximum" amount of unique items, and game crashing.

Can you explain more thoroughly?

My Civ has at least 4 unique units and 5 unique buildings, alongside a unique improvement, and it all works without issue.

I do know that the game won't allow you to mod the basic farms properly, though.
 

Ulixes

Prince
Joined
May 2, 2010
Messages
312
Here's what I did:

I deleted all uniques (units, buildings, improvements... I think that an unique feature must be earned during the game, not given from the start).

Than, I wanted to create a new improvement similiar to the french chateau but with different art for cultural group (eastern, middle eastern, american, european...), but with the same yield for every civ. I called it "Manor".

I found the Arts I needed looking in various mods.
So I created 43 unique improvements each with the ART_DEF of his group.
I did exactly the same thing for a Special Fort improvement and for an improvement similar to Feitoria (buildable only in CS territory)
So, every civ had three unique improvements, (with the same yield for all civs but with the art of a its cultural group).

I also added two new fort improvement (not unique, buildable from every civ, one in the early game, the other in the late game)

Then, I gave 12 unique units to each civ (unique Great People, I created some new ones). There the problems started.

As I said, I wasn't able to build not only the unique improvements, but also any other improvement that used non vanilla art (like the two fort improvements I mentioned), workers never finished it, the number of turns left was always the same, they worked on it forever and every time I tried to place them with IGE, the game crashed.

I eliminated the unique GP and all returned normal.

So, I don't know why this happens, maybe there's a limit I wasn't aware of, there's nothing else that can cause it, as far as I know. Anyway, I don't want to renounce to the possibility to add other uniques, therefore I thought to ask if someone have any idea on how to implement cultural variation for improvements without using uniques.
Besides, it would be much more simpler that way, (try to add a bonus from tech or policy to 43x3 improvements!) and would open a new territory for modding (imagine cultural variation for trading posts, landmarks, plantations, roads, academies, customs houses...).

Anyone?
 

bouncymischa

Synthetic Genie
Joined
Nov 28, 2012
Messages
1,537
Location
In a bottle
Anyway, I don't want to renounce to the possibility to add other uniques, therefore I thought to ask if someone have any idea on how to implement cultural variation for improvements without using uniques.
Besides, it would be much more simpler that way, (try to add a bonus from tech or policy to 43x3 improvements!) and would open a new territory for modding (imagine cultural variation for trading posts, landmarks, plantations, roads, academies, customs houses...).

Anyone?

I had been considering something like what I did with one of my civs, where I made a unique replacement for the Citadel, but it didn't work like the usual UI. Instead, I had a set of Lua code that caught when a Citadel was built by my civ, and swapped it out for an alternative "Tech Citadel" instead. This was mostly so I could have a unique Citadel graphic without really making a new improvement, although I did ultimately include additional code so that the Tech Citadel had some different functions, just to make it more distinctive.

Still, this does has the problem in that you need to define a bunch of new improvements, with all the issues of cluttering up the tech tree and the like. To be honest, what you really need is some way to dynamically change the graphics associated with the improvements, but I'm not sure how this could be done. I assume mods like R.E.D. have ways to assign unique graphics to units, based on civilization, but I've never used them so I'm not sure how they do it...
 

Ulixes

Prince
Joined
May 2, 2010
Messages
312
There's an entry called "UnitArtInfoCulturalVariation" in the "Units" table. R.E.D. set this entry to "true" for all the units that needed a cultural variation.
Then he used a complex SQL (and a lot of new Graphic) to add diverse Art Defines to the same units.

LUA was not needed because cultural variation for units is a feature already included in the vanilla game (look at the settlers).
Sadly, this is not true for improvements.

Improvements have an "Era" variation but not cultural variation, so, as far as I know, LUA is necessary.

Unfortunately, I have no idea on how to do that. I suppose that a LUA wizard could attempt to adapt the units' cultural variation code to improvement, but it's just a conjecture.

So I thought to leave this sort of "message in a bottle". :)

I hope someone of you out there share this idea and consider it worth the effort, especially considering the possibilities it could open for graphic-modders.
 

DarkScythe

Hunkalicious Holo
Joined
May 6, 2014
Messages
804
Would you happen to have any sort of logs which might reveal another cause for your problems?

It's usually tough to mod the game in ways that Firaxis never thought of, but thinking about this graphical stuff reminds me of this thread I read a while back, regarding the possibility of using Lua 'Events' hooks to send directives back to the graphical engine.

Following his logic, you could potentially invoke the Events.SerialEventImprovementCreated to catch when an improvement was built, and then send instructions back to the graphics engine to display a different art asset.

Perhaps it's something along the lines of what you are looking for.
 

Ulixes

Prince
Joined
May 2, 2010
Messages
312
The logs were clean. Lua and Dabase log had no errors.

I'm looking at Pazyryk thread you linked (thanks for the info!), I don't know if I'm able to do it (I have no LUA skills, I tried to learn, but time is very few).
However I'll try and maybe I'll ask infos to Pazyryk.
 

Ulixes

Prince
Joined
May 2, 2010
Messages
312
Thank you, DarkScythe, you've been very kind! Follow us in the linked thread, more brains, the better! :)
 
Top Bottom