CivEffects

So, in defense of my “41 techs to NationStates” hardcode it was’t a “design”.
I didn't mean to blame you. However I think it would be wrong not to mention that I entirely disabled assigning techs this way without adding any replacement code, meaning the pope will not get any techs as it is right now.

Also, the option to purchase techs shouldn’t be limited to nation states, but rather any Civ with Tech points to spend can spend those at the start including the player. This way if you wanted to set up Advanced or more Difficult scenarios you can set the starting civ players to be able to purchase techs and all you have to worry about is setting their starting traits and the AI will choose their techs. This would be cool if there where tons of Or techs that has been talked about as the AI could choose which Or tech it wanted based on its Traits (Militaristic Civs would choose Military Category techs more often).
Yeah, we should have some advanced start code, but I think we should keep it simple or CivEffects will never be playable. The ability to add all techs of certain categories will have to be enough, possibly for quite a while. Anything more advanced than that really isn't a priority and I don't think it should be before next release.

Anyway, the CivEffects as Category and the Or bonus/penalty costs sounds like a great idea and also the ideas on assigning all Native Techs and such based on Traits.
I have been thinking about this and the more I think about it, the more I like it. It opens up lots of interesting possibilities while at the same time it is surprisingly simple in the DLL code.

Adding the same CivEffect over and over is possible with the current design, but we should consider sideffects from doing so. Somehow I wonder if it would make sense to restrict it to modifiers only. That way it shouldn't be possible to trigger unintended behaviour from XML.

We have to consider adding the same over and over anyway because I added support for "future technology" in the data structure. At some point it will be possible to add a bool to XML telling that this tech can be researched even if it is researched. This too could be modifiers only. If we are to stick to score bonus, we would have to add a score modifier to CivEffects.

Something else, I'm working on censures. It would appear that there is a lot of custom code for those. However lots of it can be replaced with generic CivEffect code. There appears to be some timer thing going on. I added a timer as well. There is a JIT array of length num censures. Set the number to say 5 if you want it to be active for 5 turns. On each turn start, it reduce by 1 until it reaches 0, where it disables itself. The custom code to disable crosses and professions producing crosses should be possible to replace with simply adding allow yield YIELD_CROSSES = -1. That will disable production of crosses and professions producing or consuming crosses (once the code for that is written). The beauty of this is the generic CivEffect code will also work if we do the same from a non-censure CivEffect using a different yield/profession.
 
the pope will not get any techs as it is right now.

I think we talked about this before. We don't want the Pope to have all Techs, only certain ones. So if we don't want to add all those techs, I like the idea where if you have a tech you also get all the ones behind it. There is some code added for the AI to choose Civics, this can be adapted to choose techs as well. So, if there is ever an Or tech, the AI can actually choose one. We can just make it random for the moment.

We have to consider adding the same over and over anyway because I added support for "future technology" in the data structure. At some point it will be possible to add a bool to XML telling that this tech can be researched even if it is researched. This too could be modifiers only. If we are to stick to score bonus, we would have to add a score modifier to CivEffects.

I had this already if haven't noticed yet, like Renaissance and Divine Right can be researched none stop and give you a bonus while you are researching them. Not sure how I set it up though.
 
After being "idle" (according to git) for 5 days, I finally committed again. I changed the return type of GC.getCivicInfo to a const pointer rather than a reference. This turned out to be a lot of work simply because it uncovered a whole lot of places where civics were mixed with techs, perks and some censures as well. The diff ended up being massive :eek:

https://sourceforge.net/p/colonizat.../ci/9aeea1151c70ba5be1903bb8dc0844649b6485fd/

I noticed the portrait code. I wonder if it can be replaced with the button code or if it is doing something else.
 
I added Tech Category as CivEffects. Now whenever a tech is added/removed from the player cache, the category is also added/removed. Currently there is no way to remove a tech once a player obtained it, but just to be safe, I added support for removal as well in the cache.

I also added CvGlobals::getIndexForType(). You give it a JIT array type and a string and it will act as FindInInfoClass(), except that it only checks in the file set by the JIT array. This mean it will be possible to write XML reading code where it expects say a tech category and if you write a civic option instead, it will not just grab that value and be happy with it. Vanilla doesn't care which file defines the string as long as it is defined, hence getting an index from the wrong file is possible.
 
I added Tech Category as CivEffects. Now whenever a tech is added/removed from the player cache, the category is also added/removed. Currently there is no way to remove a tech once a player obtained it, but just to be safe, I added support for removal as well in the cache.

This makes me think about a Dark Ages event, where the player looses techs. In some Historical scenarios this could be forced. We could also make a game mechanic that if your empire is really stretched out, and you are having issues with providing enough resources to manage your Civics, Barbarians invading, peasants revolting, etc. then you could be forced into a Dark Age Civeffect for several turns that removes Techs, restricts certain yields from being produced, and potentially splits your empire. This would be a cool effect for WHM. In one of the Civs you could induce a revolution that could split an Civ into two different Civs, thus slowing down the progress of a leading Civ. The Dark Age event could be used in the same sense and Player actions can help push Civs to the brink of Dark Agedom, an inverse of a Golden Age.

Anyway, I am still quite busy with school and real life events so my idle time is probably quite high. I am hoping to have some time this week to finish up the Spy code I was working on for the REF then play out that saved game.
 
We could also make a game mechanic that if your empire is really stretched out, and you are having issues with providing enough resources to manage your Civics, Barbarians invading, peasants revolting, etc. then you could be forced into a Dark Age Civeffect for several turns that removes Techs, restricts certain yields from being produced, and potentially splits your empire.
While the concept of penalties for a quick spread is interesting, I'm not sure I like the concept of splitting an empire due to this. I imagine quite a number of players being really upset the first time they encounter it and dropping the mod. I really don't want that to happen.

I have seen other attempts to prevent too quick spread and to be honest quite a number of them are more annoying than fun. Also we do have one such feature already, which works quite well: natives. There simply isn't free land to suddenly build 10 new cities.

Scenarios can drop techs just fine. That is they can once I finish the python interface. I can also imagine some event, which removes all techs of a certain category and then bans all techs in that category. Some Geneva convention type event. The only thing really missing for this to work is the event CivEffects (planned), which can be assigned from python. It would need one to ban the techs.

Anyway, I am still quite busy with school and real life events so my idle time is probably quite high.
Are you busy or idle :confused:
 
I remember when I proposed the 'Dark Age' event for WHM, for the idea of making it harder to be the dominant or only 'euro-player' left at the end of the classical era, and then just being left to conquer the world 'on your own'...

It took me so long to even convince you guys that the 'dark ages' was still a real thing.. Now Kailric wants to swoop in and be all like 'hey guys, wouldn't it be cool if we had the dark ages!!'

If I wasn't so damn lazy I would sue you all and become a crazy law suit american!!! :p

Thankfully I am british and we take a much more civilised approach to life!

The Dark Ages and Civil War is a proper motivating factor for keeping your population loyal though!
 
Sorry, Lib, I do remember you mentioning something about that, but I failed to give you credit as I did think about you when I wrote that. I couldn't remember exactly what you said and then forgot to ask like, "Lib mentioned something about a Dark Age event, what was it?"

Yeah, some Players may not like the idea of having their empire split, but some may find the threat of that realistic and adding to the drama and fun of playing. It could be setup as an Option "Split Empires". One of the Civs did this, not sure which one but I remember always trying to make a leading Player split his Empire.
 
The Rhyse and Fall Mods did this sort of thing, except that it was historical emerging empires and they would appear and culture flip lots of the 'local cities' to form their new empire.

It would definately be a cool system to have, because you could also have a bunch of scenarios that see you take the reigns of the Roman Empire at the moments before it's fracturing.

Can you keep the empire together?
 
Technically speaking I don't think it would be that tricky to split an empire. It would be something like init a player, which has never been alive and then a series of change ownership, possibly copying techs and stuff. A few things would need to be assigned to something new, such as leaderhead and it should always be an AI.

I'm not convinced it would be fun, but if you like the idea, I guess we will end up with it eventually. It would likely be something like prospecting where the code is added, but most people end up not activating it.
 
Technically speaking I don't think it would be that tricky to split an empire. It would be something like init a player, which has never been alive and then a series of change ownership, possibly copying techs and stuff. A few things would need to be assigned to something new, such as leaderhead and it should always be an AI.

I'm not convinced it would be fun, but if you like the idea, I guess we will end up with it eventually. It would likely be something like prospecting where the code is added, but most people end up not activating it.

Yes, we already have this with Vassal Players, just not copying Techs and Stuff, yet.

And in defense of prospecting, it isn't finish yet, and I myself didn't like it in its initial state that much to start with, but with the improvements I already made I am starting to like it more. And I feel with even more implementation improvements it will get even better and become a real Diplomatic and Strategic element. To do it right would take more than a few minor additions that I added, you can't judge a book by its first chapter;) Well, you can but you may be missing out on a stupendous ending ;)
 
Another neat feature for Techs with multiple "Or" prereqs comes from the Rise of Mankind mod of Civ4. In that mod, you can get a slight discount to research for each one of the "Or" Prereq Techs you have completed. For example if Philosophy requires Writing or Religion or Code of Laws as prereqs, you still only need a minimum of one of the prereqs, but if you have more you can get -5%, -10%, or -15% discount to researching Philosophy depending on how many of its prereqs you have completed. :king::science:
I coded this (not committed yet) and it was as easy as predicted (was helped a bit by my recent InfoArray updates). However I wonder if we could do better than this.

Technically what we need is a single InfoArray where we have to know how many techs we need to be allowed to research this. First I wondered if it would be ok to simply add one to XML and then an int telling how many you would need to be able to research the tech. However that involves counting and possibly out of sync updates, which made me come up with another approach.

Two arrays are read from XML, one regular and one Or. On load, those two are merged into one. A number is also stored, which is the -length of the regular array. The calculation is then as follows
  1. score = -length
  2. loop info array
  3. for each tech in the array, which is researched, add 1 to score
It's simple and fast. At the same time it is fairly simple to set up XML to handle this.

The question is: will we suffer if we can't tell which techs are Or techs from within the game?
 
No replies :confused:

Oh well. I guess I will take this opportunity to get RaRE started. I have to do that eventually anyway.

In the meantime it would be a good idea to brainstorm on how we want techs and perks to work. I started wondering about the Master of Orion I tech system. Simply put, plenty of techs are using stuff like modifiers and other stuff, which can be good to have, but not critical. At the start of the game, the computer sets up a tech tree for you where you get a certain fraction of the techs. Which techs you can research in the game is random, but somewhat evenly distributed between tech level and stuff like that. Some techs are always in the tech tree though as they provide stuff, which will be unfair not to get access to (high energy focus with its +3 beam attack range is a good example).

What this mean is the player can't predict the tech tree and follow the same pattern in every game. I kind of like randomness like that because I feel like games tend to become too repetitive if I am presented with the very same options each time.

I wonder if we can get something like that into the game while at the same time we don't ditch the current tech tree system. Maybe we could include something like random Or techs in addition to the regular Or techs (that would make 3 requirements arrays).

Example:
A tech requires A and B.
Or requirements is C
RandomOr is D

Because there are 2 techs in requirements, the tech is possible to research is you have at least 2 of the techs A, B or C. If you get chosen to have the randomOr requirement as well, you can research if you have at least 2 of A, B, C and D. Since the setup is different for each player, some players can use D as requirement and some can't.

Another approach is to set an array of randomOr techs, filling it with say 4 techs. Then an int tells that at least 2 should be present for each player. It's possible that that we can set an int telling how many of the randomOr techs we will require to research.

This could result in a tech, which requires tech A and then B-E and you have to have two of those. You don't know which ones of B-E you can use for it, only that at least 2 will work. It might be that you can use B and D, it might be C and D or even B, C and E.

If we add some tech tree analyzer to prevent broken tech trees, a system like this could make dynamic and random tech trees. Maybe all techs will be available to all players, but not in the same order. Maybe some bonus techs will be available to some players. Also modders could just not fill out the random part, making the current system stay as it is. This mean the tech tree can be made as much or little random as the XML modder wants it to be.


However before making such a system, we should think it through and agree on how we want it to be. Forget about the current system. Brainstorm on how you think we could make a new system, which will be unique, modder friendly and do precisely what we want it to do.
 
The question is: will we suffer if we can't tell which techs are Or techs from within the game?

Well, we should always be able to tell based on the XML right? The Tech Tree would need to know in order to build the tree correctly.

No replies :confused:

I started to reply on my phone but was interrupted and never went back to finish.

However before making such a system, we should think it through and agree on how we want it to be. Forget about the current system. Brainstorm on how you think we could make a new system, which will be unique, modder friendly and do precisely what we want it to do.

I like the idea of randomness. As I have mentioned before with certain "Bonus" techs gained from having Masters working for a certain amount of time gaining Bonus Tech points. (That may could be a new category, Bonus Techs). This system, and the one you mentioned, could be put together somehow. When we study history we see that there where many technologies gained by Civs that where never gained by others even in close proximity. Some techs have been lost to this day (the exact make up anyway, or exactly how they did it). On the Tech Tree we could have special "Hidden Tech Panels" that do not reveal what they are until you research up to them, then a Random Tech is chosen.

I'll think about it some more as soon as my head isn't full of sternocleidomastoid, deltoid, and bicep brachii mucles.
 
Well, we should always be able to tell based on the XML right? The Tech Tree would need to know in order to build the tree correctly.
The XML file tells which techs it might require. However if we set XML to require either A or B, we will not know if it is A or B the game picked for us for this specific game.

I have been wondering about the tech tree and randomness. I'm not sure what to do. If would kind of spoil the surprise to tell if we can start a game, open the tech tree, see if we like the randomness of this game and then restart if not.

Maybe we should rethink the tech tree (now would be a good time since I broke it anyway with CivEffects). One approach would be to only display the techs you have researched and can research. This would make the tree grow as the game progresses.

Expanding on that idea, we could add something like each time you research a tech (or some other research related event), each tech that you have at least one requirement for might show up, again based on randomness. Other requirements could then be "one hidden tech" or if partly revealed "one economic tech" or the name of the tech. The chance of discovering something about a tech could then be 10 out of tech cost modifier, meaning if you get a 10% research cost discount, the chance for you to discover something about that tech ahead of time is 1 out of 9 instead of 1 out of 10.

While I like this from a game point of view, I wonder if it gets too complex to code within reasonable time. Maybe we should simplify it to something like displaying techs for current and past eras or something. Maybe restrict further to techs where you have at least one requirement. Maybe add all techs, where you have one requirement of one of the requirements.

The debug menu should be able to turn "view entire tree" on and off.

We should also consider perks. I intend to make them work like techs, except requirements will be set in an array of father point types.

There are plenty we could do, but before we consider way too much about the GUI, we should figure out how we want the techs to behave. It's a bit silly to discuss display of something where it is an open question what should be displayed ;)

One thing, which has been mentioned is adding a tech tree for each tech category. If we do that, we should consider how to code the GUI for that and what to do if we have requirements from another category and so on.
 
Well, we should keep the current system functionality in tack and any changes can be moddable. It takes quite some time to create and test a Tech Tree. M:C'a tech tree,,as simple as it is, is in need of a revamp and balanced better. To add a more complicated system would take quite sometime. It would probably be faster to code it than to actually add our ideas to the XML in a well balanced tech tree. This should be reserved for a update by itselft probably?
 
Top Bottom