what were they smoking with SocialPolicyPopup.lua?

Putmalk

Deity
Joined
Sep 26, 2010
Messages
2,652
Location
New York
This isn't much of a modding question/thread as it is a general complaint (since I'm using the button implementation to draw an interface...)

Why isn't each policy branch an instance (attached to a horizontal scrollpanel so that if we add more than the allowed policy branches it would fit nicely)? Why are the panels hardcoded? What benefit does this serve at all?
 
What benefit does this serve at all?

The grunt work can be delegated to a junior/temp member of staff ... "Here's one that works, now make it work for another nine"

You can see the same approach over and over again in the code (both C++ and Lua), eg Great People handling in the DLL and Civilopedia.lua (my personal pet hate file)

What's really maddening is when someone has taken the effort to make the UI section modular (eg DiploOverview) but then when they add something similar they go back to the old copy/paste approach (eg ReligionOverview), and to some extend the way that Faith was quite clearly initially implement in the same "design-less" approach as "JONSCulture" and then (improperly) converted to a yield.

It cuts corners and saves cost/time in the short-run.
 
The grunt work can be delegated to a junior/temp member of staff ... "Here's one that works, now make it work for another nine"

You can see the same approach over and over again in the code (both C++ and Lua), eg Great People handling in the DLL and Civilopedia.lua (my personal pet hate file)

What's really maddening is when someone has taken the effort to make the UI section modular (eg DiploOverview) but then when they add something similar they go back to the old copy/paste approach (eg ReligionOverview), and to some extend the way that Faith was quite clearly initially implement in the same "design-less" approach as "JONSCulture" and then (improperly) converted to a yield.

It cuts corners and saves cost/time in the short-run.

:mad: :mad: :mad: :mad: :mad:

I understand the cost cutting but man this sucks. :cry:

I haven't looked into Faith but I do have to make a custom yield for my mod: how is faith implemented? Why was it "improperly" converted?
 
Why was it "improperly" converted?

The base yields (gold/production/food) have additions (ints) and modifiers (percents) for units/buildings/traits/etc, both culture and faith only have some of them - depending if they were needed for the base game / scenarios. Also, a lot of the code that accesses culture yields just calls down into the "JONSCulture" c*** so you end up with two possible ways to change values, one of which may or may not be cached with objects (IIRC there is a way to add culture to a city that doesn't get saved if you call the wrong one of the two approaches)

It's a minefield of poorly written code. It used to be said that "a good Fortran programmer can write Fortran in any language" (and it wasn't a compliment) - it would seem that this now applies equally to C programmers
 
Also, a lot of the code that accesses culture yields just calls down into the "JONSCulture" c*** so you end up with two possible ways to change values, one of which may or may not be cached with objects (IIRC there is a way to add culture to a city that doesn't get saved if you call the wrong one of the two approaches)

:sad: speechless.

I'll keep that in mind when I write my custom yield...
 
I'll keep that in mind when I write my custom yield...

Use Gold/Prod/Food/Science as a template. "Move away from Culture/Faith nothing to see here"

And while we're raising the lack of design in yields, why isn't Tourism a yield?

You can almost hear the meeting "Ok, so we did Gold/Prod/Food/Science as yields, botched Culture ([from the back] and don't forget Happiness), then 'corrected' Culture when we added Faith (but forgot Happiness). Now we need Tourism. Hey, that's special (like Culture/Hapiness/Faith) let's not make that a yield. Good Call!"
 
Now we need Tourism. Hey, that's special (like Culture/Hapiness/Faith) let's not make that a yield. Good Call!"

This irony:sheep:, i feel with you.
 
This isn't much of a modding question/thread as it is a general complaint (since I'm using the button implementation to draw an interface...)

Why isn't each policy branch an instance (attached to a horizontal scrollpanel so that if we add more than the allowed policy branches it would fit nicely)? Why are the panels hardcoded? What benefit does this serve at all?

I can understand the frustration as I want more than the allowed policy branches! However, given that this is because I would like a unique policy branch for certain civs (which might be the same for you), could there be something similar to the box for the ideologies - i.e. click the box and it takes you to a screen with your civ's unique stuff on it?
 
I can understand the frustration as I want more than the allowed policy branches! However, given that this is because I would like a unique policy branch for certain civs (which might be the same for you), could there be something similar to the box for the ideologies - i.e. click the box and it takes you to a screen with your civ's unique stuff on it?

Yes as long as you code it correctly.
 
The worst thing is when you get dragged into the same pattern yourself. I added another policy branch following the existing copy/paste code (and felt dirty afterwards). On the other hand, I knew that I would add more than a few city processes, so I rewrote that code from scratch to use instances. (Probably the reason Firaxis never added a "culture process"; they looked at the code and realized that it was hardcoded in UI and would be too much work to add.)

Tourism isn't really a "yield" is it? I mean it's a value, yes, but it's never generated from a plot. One could have any number of values like health or happiness or crime or whathaveyou that are not treated as a yield per se, even though they are added or modified by various things. I've added many of these in my mod without attempting to "add a new yield". The difficulty there just seemed too high for the payoff.
 
Tourism isn't really a "yield" is it? I mean it's a value, yes, but it's never generated from a plot.

Could be generated from things on a plot - Natural Wonders, Moai, and any number of things that I haven't thought of but others may.

It's as much a "yield" as culture and faith are
 
This isn't much of a modding question/thread as it is a general complaint (since I'm using the button implementation to draw an interface...)

Why isn't each policy branch an instance (attached to a horizontal scrollpanel so that if we add more than the allowed policy branches it would fit nicely)? Why are the panels hardcoded? What benefit does this serve at all?

Yeah, tell me about it. It is incredibly poorly designed, especially as far as mods go. I've been working on a substitute for that one for a while (attached a pic of it to the post), both for more flexibility with the number of trees as well as their size. It's been slow going though, since I never touched this sort of thing before I started.

It is coming along nicely, though. It loads the branches from the game data and builds new buttons in the list from that. I'm currently working on a "poilicy branch class" system to let you organize them into different lists (that would be shown on seperate tabs) to present them better (in the future I would like to be able to have them all be independent from each other, in terms of scaling costs and yields, but I don't know how to do that yet). I can post a link to it here when I'm done with it, if you want.
 

Attachments

  • Policiesv1.png
    Policiesv1.png
    225.9 KB · Views: 278
It's as much a "yield" as culture and faith are
From a long-term coding perspective, I think it would have been easier if they treated everything as a yield. Culture, faith, happiness, GP points, Golden Age points, ...maybe even resources. Code it generically so that you could later tack on health or whatever very easily.

Instead, they coded 3 yields. Then tacked on additional things as they went with more or less yield-like code.
 
As a working solution to the yield problem, I am right now working on a modmod of Community Call to Power that, among other things, adds health, plague, and happiness to the game as yields. The last one, though, will have to go through an idiotic dummy-building/Lua SetHasBuilding() process in order to really work (although it will be useful for future modders, and for myself, to add the effects of local city happiness).

Pazyryk's proposal that resources should become yields is something that I have not heard of, and implemented in the right way it would have merit. However, in the short run, I feel that the biggest problem yield-wise is the way that Tourism and Happiness are currently (poorly) handled.

On a related note, does anyone know how to add yields to Great Works, and how to add GW types? It's particularly idiotic that buildings like the Heroic and National Epics, as well as various others added in CCtP (al-Jabr, Principia Mathematica, Three Laws of Robotics, etc.) need to be "built" rather than written. Another idiotic thing related to Tourism - Wonders don't add it! How could Firaxis have overlooked something so basic?
 
Resources (along with buildings, units, improvements, features, terrains, etc) generate yields, they are not themselves yields
 
Another idiotic thing related to Tourism - Wonders don't add it! How could Firaxis have overlooked something so basic?
It was strange before that most of them added only 1 culture. Seems pretty basic that almost all of them (maybe a few exceptions) should contribute significantly to both culture and tourism. (Balance with cost or other effects if needed.)
 
Sorry about that - I'm more or less done, but I've gotten sidetracked in a major way; myself and some others from the RifE team are working on a bigger mod framework thing that is sucking up a ton of time, and it got lost in there somewhere. For that system, it's not done. But for a less invasive mod or vanilla, it should be ok.

I should be able to pull something together and post it here shortly. I'll get back to you.

Edit: I've attached the .civ5mod package to this post, as well as the project for it. It has more or less been sitting unchanged for a month or so (didn't seem like people were that interested, so I figured I could backburner it - again, sorry about that). It should be functional, but please keep in mind that this is early days for my civ5 modding career, so be prepared for some bugs or lack of polish here and there. ;) If you do find some bugs, PM me and I'll get to fixing them. Ditto if you have suggestions.

As with all of my stuff, feel free to use it for other projects, as long as you let me know about it, and give me credit.
 

Attachments

Back
Top Bottom