New Civics Screen

I don't know if it would help, but the caveman 2 cosmos team fixed the XML.save system, whether it would work for col I don't know, but you could.ask around their forum
I read their code in this regard and I don't like it. the code uses 130 kB of code in new files (not counting changes in existing ones) and it needs to be modified to fit our needs (there is no professions etc). The code isn't easy to read and I ditched it half way though. Still it is their concept idea, which gave me an idea on how to do this.

Instead I will make it work as an extension to JustInTime arrays, a piece of code I wrote from scratch for RaRE and later moved to RaR and M:C. Naturally C2C doesn't have that and because of that can't make the rather clean solution I plan. As JIT arrays have a read and write function already, modifying that one will add this feature everywhere those arrays are saved without modifying each file.

My approach will only need changes to individual files if they save an array of say promotions if they aren't saved as a JIT array as we need to change those to JIT arrays. That would be a good idea anyway as they are designed for high speed and low memory usage. On top of that JIT arrays handles stuff such as out of bounds assert checks automatically, making code using them much cleaner and more readable than the vanilla style arrays.

Another thing. C2C saves a whole lot of strings and converts between strings and ints when loading and saving. This makes savegames around 40% bigger and slower to read and write. I plan to save the strings just once in each savegame, meaning size will not really make a huge difference and performance will suffer much less. Saving speed should be mostly unaffected, but loading might be slowed down a bit. Due to autosave I consider saving the important one of those two.
 
I can't remember having made changes to that. If I touched that part, then it is likely converting from a vanilla array to a just in time array. It sounds like vanilla code to completely ignore promotions when working inside a city. After all no vanilla promotions would affect in city citizens anyway.

The code in question is this, it has your name on it;) I am thinking I can add code to this take away promotion code that checks if the Profession is a city profession and if the Promotion is a Civilian promotion, if so then it stays on.

Code:
// CombatGearTypes - start - Nightinggale
		PromotionArray<int> aiPromotionChange;

		if (getProfession() != NO_PROFESSION)
		{
			CvProfessionInfo& kProfession = GC.getProfessionInfo(getProfession());

			if (kProfession.hasCombatGearTypes())
			{
				for (int iPromotion = 0; iPromotion < GC.getNumPromotionInfos(); ++iPromotion)
				{
					if (isHasPromotion((PromotionTypes) iPromotion))
					{
						aiPromotionChange.set(-1, iPromotion);
					}
				}
			}
		}
		// CombatGearTypes - end - Nightinggale

PS I got your PM, I'll review it better when I have the chance. Overwhelmed atm.
 
The code in question is this, it has your name on it;)
Ahh that. It's something something different though. The vanilla code checks if the unit can have the promotion in question. My change is that it is valid if it fits at least one combat gear type. Say we have a promotion for range attack units and one for mounted troops. With vanilla code it would only use one of those. I changed it into giving range attack and mounted gear types and the unit can have both promotions. I didn't really look at promotions there, just added the code to check all the unit's combat gear types.
 
Ok, to break the 3 day silence in the Civics Screen thread I have a new update. Here is the list of the new Luxury Units and Default Units and the Civics they are under...

New Default unit is listed first. The one is bold italic is the Luxury Unit that can be promoted to the next two units. The one in Green is the new Default Unit. Default Units are still Free Peasant if none is listed. In the Picture the UnitTypes starts from the back row to the right we have...

Fuedalism
Serf(Not in picture)
Page, Squire, Noble

Hereditary Rule
Recruit, Cavalryman, Commander(Emir is Arab society)

Patriarch
Eunuch, Chamberlain, Vestarch

Guilds
Burgher

Parliament
Aristocrat

Theocracy
Elder(Sheikh like unit)

Slavery
Slave Warrior

 

Attachments

  • NewLuxuryUnits.jpg
    NewLuxuryUnits.jpg
    167.2 KB · Views: 155
It seems a bit strange though to have 'Slave Warrior' as a default unit..
Would it not be better to make it just a slave, who can be 'professioned' as a slave warrior?
A slave warrior is a slave with special warrior training, kind of like how veteran soldiers is a free colonist with special training. Think of it as a kind of veteran soldier, which you can give soldier profession, but you can also give it other professions. At least that is how I understand it.
 
woh nice :king:
did you import those to Col using Blender? I have always had trouble getting that to work correctly.

How does the promotion to the higher-tier unitclasses in the chain work? I would think the Eunuchs chain would be mostly non-military while others wouldn't so they'd need to be able to gradually promote in a variety of ways.

I'd like to add elite citizen types to 2071, but I guess it just doesn't fit to generate them from a Luxury Food yield especially if there are different classes of elite units (I think Alien ideas about what's a delicacy or not can be pretty distinct :p:assimilate::evil:) Still, maybe the base system could be useful or enable an Insectoid race with Worker and Ruler castes :hmm:.
 
woh nice :king:
did you import those to Col using Blender? I have always had trouble getting that to work correctly.

It is really quite simple. I'll post a quick tutorial when I get the chance.

How does the promotion to the higher-tier unitclasses in the chain work? I would think the Eunuchs chain would be mostly non-military while others wouldn't so they'd need to be able to gradually promote in a variety of ways.

On the contrary, they were highly into military affairs. Take Narses for instance, a renowned General for Justinian I. Anyway, there are two ways to be promoted, or two tiers in M:C. You could technically have any number of tiers.

Page example code for 1st tier.
Code:
<iCasteAttribute>2</iCasteAttribute>
<bPreventFounding>1</bPreventFounding>
<bPreventTraveling>0</bPreventTraveling>
<EducationUnitClass>UNITCLASS_SQUIRE</EducationUnitClass>
<RehibilitateUnitClass>NONE</RehibilitateUnitClass>
<LaborForceUnitClass>UNITCLASS_SQUIRE</LaborForceUnitClass>

iCasteAttribute = 2: Means this unit can not be military, Pages are only this
EducationUnitClass: This is the class the unit will promote to while being educated in schools etc.
LaborForceUnitClass: This is the class the unit will educate to while simply working in the settlement and in any profession.
RehibilitateUnitClass: Not part of this system, but if a unitclass is here this unit gains "education" from other Units that work in your Courts.

Squire example code second tier:
Code:
<KnightDubbingWeight>1000</KnightDubbingWeight>
<iCasteAttribute>3</iCasteAttribute>
<bPreventFounding>0</bPreventFounding>
<bPreventTraveling>0</bPreventTraveling>
<EducationUnitClass>UNITCLASS_NOBLEMAN</EducationUnitClass>

iCasteAttribute = 3: This sets it up so that the unit can be educated in Schools etc (may can be removed actually)
EducationUnitClass: This is the class the unit will promote to while being educated in schools etc.
KnightDubbingWeight = 1000: This sets it up so that this unit can be promoted while working in your Townhalls, Palaces, etc, gathering Fealty.

Note: For this update I have removed the ability for other units to be promoted to "Honorary Knights". Like a Master Brewer will no longer receive this title.

I'd like to add elite citizen types to 2071, but I guess it just doesn't fit to generate them from a Luxury Food yield especially if there are different classes of elite units (I think Alien ideas about what's a delicacy or not can be pretty distinct :p:assimilate::evil:) Still, maybe the base system could be useful or enable an Insectoid race with Worker and Ruler castes :hmm:.

I don't see why this wouldn't work under the new system.

Ah I get it with the slave now.. yeah that would be fun.

Yep, think Mamluk. These guys had statuses even above your Free man, and could grow high in rank. Mamluk means "property" or "owned slave" of the king. So, under Slavery your Empire will create these special military based units.
 
the other thing is you could just use the yield_grain code and just rename the description to something more fitting... I don't know what elite yield type would be more fitting... citizenship papers? pff I don't know :D
You can set luxury growth yield in the yield header. However it is hardcoded to this one for all civs and civics. Ideally I would like to make one growth code and then at runtime it executes for each yield type, which can provide units. That way different civs can use different yields (food/alien food) and change these with civics.

The only problem is that I'm currently clueless on a design for how to write code working like that :p
The great part about the hardcoded yield is that it performs well. Changing to runtime checks will slow down the game meaning performance plays a major role in the code design. It should be doable with caches, but then those should be designed.

Another major setback in this is the fact that I'm not working on it.
 
Another major setback in this is the fact that I'm not working on it.

Hmm, I can't figure out if you were trying to be funny or serious. Was you saying that you would never work on this? Or are you saying that it want be done because you're not working on it right now? :confused: :D

I made a push to Civic_Screen. I added in the New Default Luxury Units and Default Growth Units. Thanks to Nightinggale for this addition:goodjob: I added in Initial cost. While in the Civics Screen, if your Civics choice's initial cost are more than your current gold you will not get the Start Revolution button, instead it will say "Lack Funds". I added code to support YIELD_GOLD as an Upkeep in CivicInfos, and only YIELD_GOLD. Any other yield will do nothing.

You can find the new units in my onedrive drop box link below.

https://onedrive.live.com/redir?res...086&authkey=!ABC2ET1ZidNZmkI&ithint=file,.rar

I added Hardy Worker as a Default Growth Unit to Bureaucracy.

Still on To do List
  • add Tech Requirements
  • add Anarchy Times
  • add Civic Buttons
  • add Buttons for new Units
  • review Tech, Trade Perk, and Civic bonuses and play test
  • add New Unit Pedia Help Text

I am adding one more item to the todo list and that is to add descriptions for all the new units in the Pedia. Since understanding these units is critical to your Empire I want to have them explained right from the start.
 
Hmm, I can't figure out if you were trying to be funny or serious. Was you saying that you would never work on this? Or are you saying that it want be done because you're not working on it right now? :confused: :D
It means I haven't looked at the code at all to figure out how to do this task. I'm working on the language feature where you don't have to add all languages to all strings. It turned out that C2C uses apache for it and to avoid introducing a 3rd party library I have rewritten everything. It sort of works now, but it needs cleanup and it is missing certain details like names of languages.

I discovered that we have TXT_KEY multiple times and that it is often, but not always blank. What is the point in that one :confused:

I made a push to Civic_Screen.
Hmmm.... I didn't get an email about it. orlanth failed to push meaning github might have issues at the moment.

You can find the new units in my onedrive drop box link below.
This will work for now, but we need to do something about graphics distribution before we have to add 10 files from 7 different threads to get everything working.
 
It means I haven't looked at the code at all to figure out how to do this task. I'm working on the language feature where you don't have to add all languages to all strings. It turned out that C2C uses apache for it and to avoid introducing a 3rd party library I have rewritten everything. It sort of works now, but it needs cleanup and it is missing certain details like names of languages.

Ah, akk

I discovered that we have TXT_KEY multiple times and that it is often, but not always blank. What is the point in that one :confused:

Hmm, I use the TXT_KEY in my text file as an initial copy and paste. So like when I want to add new text I copy TXT_KEY and then just modify it. Is there a better way? I see I have done this in 3 different files, should I name then all different? The Janimals files do the same thing looks like, he must have had the same idea I did:crazyeye::lol:


Hmmm.... I didn't get an email about it. orlanth failed to push meaning github might have issues at the moment.

I was able to push, pull your changes, merge them, then push again, so working for me.

This will work for now, but we need to do something about graphics distribution before we have to add 10 files from 7 different threads to get everything working.

Ok, have we come up with an alternate solution yet, other than the sourceforge suggestions?
 
Hmm, I use the TXT_KEY in my text file as an initial copy and paste. So like when I want to add new text I copy TXT_KEY and then just modify it. Is there a better way? I see I have done this in 3 different files, should I name then all different? The Janimals files do the same thing looks like, he must have had the same idea I did:crazyeye::lol:
The need for a language template will likely go away when we don't have to fill out all languages. In the near future it should be allowed to write
Code:
<TEXT>
	<Tag>TXT_KEY_CIVICOPTION_INVENTIONS</Tag>
	<English>Medieval Research</English>
</TEXT>
Easier to remember and copy pasting a random TEXT and then edit it shouldn't be much of an issue.

I might delete some of the TXT_KEYs then. They might cause problems for my new code. My code assumes empty strings to be the same as non-existing strings and will apply the English one instead. That isn't nice if the English string has the same issue.

Ok, have we come up with an alternate solution yet, other than the sourceforge suggestions?
Not apart from dropbox. It isn't an urgent problem. It's just something we need to sort out before doing multiple major graphical changes.
 
To be honest the graphics system isn't an issue at all..

You simply have to designate a 'head of graphics' and all graphics work goes to them which is then integrated into a central collection, I vote Kail and his dropbox.

Since currently he is the only one doing graphics work, it is doubly not an issue right now, and any new artists that join can just be briefed by Kail on how it works. To save even more time, Kail can just start a thread on 'The Graphics System' of where he wants graphical stuff and graphics links sent to. Then merge and release it to everyone when a sufficient amount of graphics have been updated to make it worth a release. For test versions, you don't even really need the new graphics, just test the mechanic and when we are happy it is not exploding realease the next public version with the new graphics and everybody updates.
 
To be honest the graphics system isn't an issue at all..

You simply have to designate a 'head of graphics' and all graphics work goes to them which is then integrated into a central collection, I vote Kail and his dropbox.

Since currently he is the only one doing graphics work, it is doubly not an issue right now, and any new artists that join can just be briefed by Kail on how it works. To save even more time, Kail can just start a thread on 'The Graphics System' of where he wants graphical stuff and graphics links sent to. Then merge and release it to everyone when a sufficient amount of graphics have been updated to make it worth a release. For test versions, you don't even really need the new graphics, just test the mechanic and when we are happy it is not exploding realease the next public version with the new graphics and everybody updates.

Yeah, that's basically what we will do until we can ever upload art files to a "git" like site.

Speaking of graphics I made the new Unit art buttons and city management icons this morning...

https://onedrive.live.com/redir?res...094&authkey=!AIXtDsc5SqRfMSs&ithint=file,.rar


Yeah, I plan to create a post where I explain how I add custom units to Col and also some of my tips and tricks for making units/buttons/etc. So, I can post instructions there.
 
Originally Posted by Kailric View Post
Hmm, I use the TXT_KEY in my text file as an initial copy and paste. So like when I want to add new text I copy TXT_KEY and then just modify it. Is there a better way? I see I have done this in 3 different files, should I name then all different? The Janimals files do the same thing looks like, he must have had the same idea I did
The need for a language template will likely go away when we don't have to fill out all languages. In the near future it should be allowed to write
Code:

<TEXT>
<Tag>TXT_KEY_CIVICOPTION_INVENTIONS</Tag>
<English>Medieval Research</English>
</TEXT>
The XML generator has some functions to automatically make TXT_KEY and PEDIA entries for each of the XML content items, I should be able to update these if the format changes. It can also include a few relevant hyperlinks in the Pedia TXT_KEYs which is nice since those are painful to generate by hand while having all the links match up.

Yeah, I plan to create a post where I explain how I add custom units to Col and also some of my tips and tricks for making units/buttons/etc. So, I can post instructions there.
cool :cool: I did manage to get a few custom units into 2071 using other tutorials, but there still seems to be a lot of cases where nifty unit nifs from Dunewars etc suddenly cause CTD when viewing them, where I wasn't able to find out why :confused:
I think in some cases it's looking for content in the Shared folder of the original Civ4 mod (or some sort of Effects animation) but it's hard to find out what it's looking for.
 
Top Bottom