DarkSparkNecron / NationGen-N

NationGen is a program that procedurally generates new playable nations, including graphics, for the strategy game Dominions 5 published by Illwinter.
3 stars 0 forks source link

Colonial system - beginning #1

Open DarkSparkNecron opened 1 year ago

DarkSparkNecron commented 1 year ago

So last and essential feature for 0.8.0 release should be underwater recruitment for nations that have #uwbuild connabd\nationtheme. This is the straight road to belowed (by me) uw nations, however, they're for some other big update.

Missing uwrec was spotted by me and bok during our second natgen game (KeyN2) 1.5 years ago and since that time it was quite disturbing that unlike vanilla land uw-capable nations can build forts underwater, but cannot recruit anyone except indies in them. This is bad from the point that every fort to addition of indies have some troops, at least one commander to lead them, priest and\or mage. So every fort can be self-sufficient as 'mini-capital'. However, natgen's uw forts are not, this is getting worse by the fact that uw indies havent priest or mages nearly at all in comparison to land indies, so, you understand I guess.

To solve this natgen should generate a bunch of unit underwater, however, in vanilla uwrec is really similar to a terrain recruitment in appearance and also sometimes called a colony. So after a think it was decided, that a brand new colonial system will be introduced into natgen to generate underwater colonies and other terrainrec.

Following is a preparation stage to scratch grounds.

Previous entry was just an experiment and must be deleted to clear way for the next one.

At this point starting adding colonies, for now only underwater ones and in very early stage.

Following isn't a required feature for 0.8.0-DEV2, if it will occur. Making this will be whole another adventure into pain lol. However its required for every uwrec.

As it was just an early implementation futher work will be required, however, its for 0.8.0+ updates. Non-hardcoded types of colonies should be added, and non-uw terrainrec colonies. So, future work will be in messing with file system and other fun stuff. At least coastrec and coastfortrec colonies should be made possible before arrival of underwater nations, or just as a part of an update that will introduce them. In such case these colonies will work similar to created uwcolonies.

DarkSparkNecron commented 1 year ago

Note: this, as any other issues I will open are for people that will try to help to achieve what I wanted to do, but failed, forgotten, or didnt even started (really far plans). i hope you got the point.

Im writing this after i completed 2 first tasks. Fun to say that I spent a lot of days just figuring out how things works to just create this murky plan in my head.

Well, currently terrain rec is handled by special unit tag "specrec", which can have several arguments, each of which will create an recruitment entry. heres the list:

Most of them allows for fortless recruitment in said terrain, but uw is for underwater fort recruitment, land - fort landrec for uw nations, coastfort - recruitment in coastal forts (up to 2 coms and 3 troops - manual says), alsocommon - tricky thing, it will create usual addrec line in addition to all other. By default this line will not appear and will be replaced by terrainrec.

DarkSparkNecron commented 1 year ago

Moving to second task. It was tricky to get race command so i feel now like adding a method for searching entries like "#uwbuild" in different command lists is a good idea. by the way

My dumb system creates up to 5 units from secondary race if:

Also this system works in a way that it borrows units from the main roster to make them uw by adding specrec tag to secrase units if limit isnt reached. this revealed to me, that usually such dumb colonies wouldnt have any commanders, and if have, their slot would be stolen from land commander (by slot i mean that natgen have tiers of commanders, so nation have 1 T1, 1 T2 etc. commanders. Also it somehow makes commanders after units are made, in shape of some units probably), but in case of colonies we shoulnt stole slot, we need to create one.

With this I probably left that idea, but if we just adding new inits there will be too many slots, or having secondary race in land at full and in uw would be strange, so we should affect amounts of primary race and secondary race, and with it making nations with colonies 'in balance' by not having too many troops than others in potential, also making it feel more logical in case of roster.

units are generated in the rostergen, unit numbers appears only here, so can be affected only in it. As ColonyGen is an entire different class, only solution I see is to start ColonyGen from rostergen with args of races and unit amount to generate.

this amount should be pretty much affected by colony type (in early stages only secondary race unit amount will matter, so it's easier) and random. We can add method GetUWColonyType, which by random, race attributes and perhaps unit amounts decide the type of uw colony.

Unit amounts in main roster will be altered depending on this and difference will go into ColonyGen to generate new units, or something like that.

DarkSparkNecron commented 1 year ago

So it was a while, I had a little vacation from development.

I realised stealing algorythm to the point when I can make results. Stealing units from main roster is a bad idea, not only because it causes cascading errors, but it also breaks stuff.

Usually nation roster has around 10 units total, and limitation from primary and secondary race, which can be equal to 100 or other very big number. Tests shouws that this is on some obscured purpuse and probably shouldt be touched without deep knowledge of SacredGen and PDGen.

If leave these bugs with only 4 land units per nation, two of which is strictly sacred, amount of stealed units is on average 2, which is not enough (and for some reason they're not even added). Because of this we must change system at least to hybrid, where colony units is added over land unit cap, and if landcap is too big - reduce it, so nation wouldnt be overwhelmed with units.

Currently we have

TypeList should be expanded due to many possible combinations of rac layouts. And probably switched to load from file as defaults (listed below are universal)

Originally when determining _ is replaced by :, but its a single char, so can be changed.

So now i think that average col has 3+-1 troops, 1 com(+1 mb if 3-4 troops) and non-guaranteed mage\priest big col has 5+-1 troops, 1-2comms, mage and priest are present. when all, maxunits for a race is already=0, or we force it to be such (and substruct it from maxunits).

Plus if switching to adding it would be very usefull to stop trying to generate units into main roster and generate into colonial ones, for that reasons Colony class should be created. It would have some pros and cons, like these rosters wouldnt be affected by commander gen and main roster will be generated normally, special filters could be easilly applyed, however, for sake of searching through national units (for restrictions, or something else) it will create whole new level of for-loops and attempts to find all places where necessary unit search exists.