Logo Platform
logo amplifiers simplified

Question for ThorTillas

Reply
Copied to clipboard!
12 years ago
Aug 24, 2012, 7:54:07 AM
Your very welcome ! ^^



I like reading or hearing somebody says that works ^^ That why we, as programmer, don't like testers on early stage of the project and like them at the end ^^
0Send private message
12 years ago
Aug 28, 2012, 8:41:34 PM
iblise wrote:
I seem to recall you saying MaxPopulation variable determines that?



MaxSystemPopulation ge MaxPopulation


No someone else guessed that but I proved that it is not true. I have no idea what value ... waitaminute... Could I actually abuse the tooltip issue for debugging purposes?



...



Nope the Variables are not resolved in the Tooltip.

Not even if I use

Then it is shown as "+MaxPopulation+0"



However, putting it in the Translation-File sounds like it could work... But how would I translate it? Foodconverstionprerequisite is a little bit long. oO
0Send private message
12 years ago
Aug 28, 2012, 7:55:56 PM
In the localization file add an entry for HabitatsBuiltTitle, no?



I seem to recall you saying MaxPopulation variable determines that?



MaxSystemPopulation ge MaxPopulation
0Send private message
12 years ago
Aug 28, 2012, 4:35:11 PM
I got another question:



I added a to StarSystemDescriptor.xml.



It is modified by



















And used by StarSystemImprovementIndustry6 like that:

$(ClassStarSystem:Population) ge $(ClassStarSystem:MaxSystemPopulation) and $(ClassStarSystem:HabitatsBuilt) ge 1



It works as expected BUT:



I have an ugly tooltip on my SELF-REPLICATING HABITATS which says: "+1%HabitatsBuiltTitle ON STAR SYSTEM".

Is there a way to have it work like I intend without the ugly tooltip?



Also: How can I check if all Planets of the System are colonized?



Edit:

Another question:

About this



This value does not go away once the "CommonEnemy" is wiped out. I set the rate at which this is generated to a high value in order to get them to gang up on others. But after the goal of the "ganging up" is achieved they stay on good terms because they keep their +90 positive Attitude.

Can I make them lose it?
0Send private message
12 years ago
Aug 27, 2012, 2:48:11 PM
Ail wrote:
Okay, after hours and hours of frustrating testing I think I nailed down 2 bugs concerning the path prerequisites.



1. The operator "eq" does not work.

../ClassStarSystem:ConsumptionPerFood is 98

$(../ClassStarSystem:ConsumptionPerFood) gt 97 and $(../ClassStarSystem:ConsumptionPerFood) lt 99 => works

$(../ClassStarSystem:ConsumptionPerFood) ge 98 => works

$(../ClassStarSystem:ConsumptionPerFood) le 98 => works

$(../ClassStarSystem:ConsumptionPerFood) eq 98 => does NOT work



Easily to workaround when you know it because le or ge almost always shall be usable in some way to find out what you want to know.



2. Whenever you compare two values they are rounded!

This is great "fun" when you try comparing two values like 0.98 and 0.5...

This just created strange results all the time and I could not understand what happened. I thought "self defined variables do not work"... But they did yesterday when I tried the example for Population*0.6.

Now I know why that worked and what I tried today didn't Population*0.6 was well enough over 1 and thus comparing it to numbers worked.



Both of the values I wanted to use in my formula are either between 0 and 1 or somewhere near that.

So I guess I will just now multiply them by 100 to make them comparable.



Took me like 4 hours of frustrating experiments to find those out. I hope a lot of people who want to mod read this so they can work around these issues.




I'm quite disappointed by these statements...

I just checked the code before posting and saw no rounding nor casting at integer... and the code is pretty similar between eq, le and ge... so no idea on what can round these values or failed to test 2 = 2...

I bet on a "out of nowhere bug"... and will add it to the bug tracking base.
0Send private message
12 years ago
Aug 25, 2012, 7:07:18 PM
If only there were an actual extension language built into the game, such as lua or python. Perhaps when they architect their next game they will consider this, which other teams have done for many years.
0Send private message
12 years ago
Aug 25, 2012, 6:24:48 PM
I'd kill for method of easily checking values in game, some simple console command that displays value x when called on. A debugging screen, having to build arguments and repeatedly adjust and refine the parameters is frustratingly slow.
0Send private message
12 years ago
Aug 25, 2012, 4:31:15 PM
Okay, after hours and hours of frustrating testing I think I nailed down 2 bugs concerning the path prerequisites.



1. The operator "eq" does not work.

../ClassStarSystem:ConsumptionPerFood is 98

$(../ClassStarSystem:ConsumptionPerFood) gt 97 and $(../ClassStarSystem:ConsumptionPerFood) lt 99 => works

$(../ClassStarSystem:ConsumptionPerFood) ge 98 => works

$(../ClassStarSystem:ConsumptionPerFood) le 98 => works

$(../ClassStarSystem:ConsumptionPerFood) eq 98 => does NOT work



Easily to workaround when you know it because le or ge almost always shall be usable in some way to find out what you want to know.



2. Whenever you compare two values they are rounded!

This is great "fun" when you try comparing two values like 0.98 and 0.5...

This just created strange results all the time and I could not understand what happened. I thought "self defined variables do not work"... But they did yesterday when I tried the example for Population*0.6.

Now I know why that worked and what I tried today didn't Population*0.6 was well enough over 1 and thus comparing it to numbers worked.



Both of the values I wanted to use in my formula are either between 0 and 1 or somewhere near that.

So I guess I will just now multiply them by 100 to make them comparable.



Took me like 4 hours of frustrating experiments to find those out. I hope a lot of people who want to mod read this so they can work around these issues.
0Send private message
12 years ago
Aug 25, 2012, 1:02:26 AM
Tomorrow I will try this one out as a general attempt to make smarter decisions about if to build food improvements or not:



Foodconsumption/Food ge Population/MaxSystemPopulation



Example:

System 1: 24/100 ge 12/16? => No, don't build food

System 2: 6/7 ge 3/6 => Yes, build food



So instead of a set limit the limit shall scale with the already produced amount of food. I plan to apply that to all food-system-improvements and as a rule for non-food-bonus-planet-exploitations. Actually I just wrote it down here so I wont forget it during the night. ^^
0Send private message
12 years ago
Aug 15, 2012, 11:19:45 AM
Hi there!



Unfortunately personal-messages to you are limited to 1000 characters. But that is not enough for my question to you. So I chose to post it on the forums. So if someone else can answer it, I would of course be fine with that too.



I'd like to ask you a pretty specific question about something you posted on the forums:



ThorTillas wrote:


-> Add a rule on all food improvement which say "When population is greater or equals to MaxPopulation * 0.6, then don't build them" for example...



I'd really like to do stuff like or similar to that but I'm lacking the knowledge about how exactly to do it.



The first thing that would come to my mind would be like that:

$(ClassStarSystem:Population) lt $(ClassStarSystem:MaxPopulation) * 0.6



Doesn't work. Apparently you can't just use normal math-operators in this context.



The second, already way more complicated thing would be defining my own Property and use that to do the math on and then access it here.

The problem seemed to be that I cannot access my self-defined property. Even when I did no math with it and just set it to a fixed value:















$(ClassStarSystem:Population) lt $(ClassStarSystemImprovement:MaxPopToBuild)



Doesn't work either. My guess is that I cannot access my self-implemented Property the same way I can with the ones that are predefined. But I'm not sure about that. I really can only say that this doesn't work.



So I'd really like you to show me how exactly you would solve your own example with the tools we modders have access too.

If I knew this one, I could start to work on my mod that has the goal of vastly improving the AIs decision-making on what to build.
0Send private message
0Send private message
12 years ago
Aug 23, 2012, 7:53:52 AM
-> Population eq MaxSystemPopulation and count(IAmAHabitat) eq 4 and all planets are either Tier1 or Tier5 (where no more terraforming makes sense or is possible)

I can think of two ways for doing it.

1)

First, like you purpose, create a new property "HabitatCount" on the star system descriptor and then add a new modifier on all "Habitat" buildings which say "Add 1 to HabitatCount on ../ClassStarSystem".

Then write this AIPathprerequisites:

$(ClassStarSystem:Population) eq $(ClassStarSystem:MaxSystemPopulation) AND $(ClassStarSystem:HabitatCount) eq 4 AND blabla(I will make an example for this part later...)



2)

First, create this new descriptor in the StarSystemDescriptors.xml or StarSystemImprovement.xml as you want.

(Basically you can create a descriptor for each "category" of improvement you want to track)



Next, modify all improvements by adding the correct "StarSystemImprovementType" in the "Descriptors" tag. Like this (I take the example on my post above to avoid searching for the correct Habitat improvement... but that will works with any improvements... Yeah I know I am lazy... but that's ok, it's a programmer skill ^^)

[CODE]



StarSystemImprovementIndustry1,StarSystemImprovementTypeHabitat



$(ClassStarSystem:Population) lt $(ClassStarSystem:FoodBuildingLimiter)



%StarSystemImprovementIndustry1Title

%StarSystemImprovementIndustry1Description







[/CODE]



And finally, write the AIPathPrerequisites that way :

$(ClassStarSystem:Population) eq $(ClassStarSystem:MaxSystemPopulation) AND count(ClassStarSystem/StarSystemImprovementTypeHabitat) eq 4 AND blabla(I will make an example for this part later...)



I think this last proposal will be more efficient. Less properties and less modifiers which are the two main responsible of "memory" use.



-> blabla(I will make an example for this part later)

and all planets are either Tier1 or Tier5

I think that the easiest way for that is to do the inverse logic... don't search to do "AND all planet are either Tier1 or Tier5", but "AND no planet are Tier2, nor Tier3, nor Tier4"...

The "brute force" solution is :

AND !($(ClassStarSystem/PlanetTypeArid) OR $(ClassStarSystem/PlanetTypeTundra) OR ...) (Well, I'm still lazy ^^)

Which is not a really nicy solution but will work. Perhaps, the AI will take a little more time to check this path, but I think this must not be over killing.



Another solution can be to add a "flag" property on the star system like "HasTerraformablePlanet" and then add a modifier on all terraformable "PlanetType" descriptors which say "add 1 to the HasTerraformablePlanet on ../ClassStarSystem". In that case, you will be able to check it by writing down something like that:

$(ClassStarSystem:HasTerraformablePlanet) eq 0



which is more elegant and efficient I think.



As always, I hope this can help you (or any other modders of course)! ^^



Cheers,

Flo
0Send private message
12 years ago
Aug 22, 2012, 6:45:46 PM
Thanks a lot for your answer! I'm really looking forward for you to "add more possibilities on the "Path" interpreter like basic operation (mult, add, div, etc),"



I also thank you for showing other ways to achieve what I want to.

I will try if it works and if it does, I will have a lot of work by "trashing" the StarSystemDescriptor.xml with a lot of fancy new variables and formulas. You know, I want to simulate the efficiency of all the buildings.



One more question that your answer let me think about.

You say:

"You ask him to get $(ClassStarSystemImprovement:MaxPopToBuild). But the AIPathPrerequesites start on the System you choose to build the improvement. So the interpreter cannot fit the StarSystem with the tag "ClassStarSystemImprovement" and return a 0.

Even more, the improvement is not constructed yet, so you cannot access any of his properties..."



So is there any way to check if a specific building or type of building exists and in what quantity? For example by giving the ClassStarSystemImprovement a new Parameter like "IAmAHabitat" and set this value to 1 for the habitat-improvements so the ClassStarSystem can count them.

For example if I want the AI to only Build Industry6 (the one that converts food to production) only when:

Population eq MaxSystemPopulation and count(IAmAHabitat) eq 4 and all planets are either Tier1 or Tier5 (where no more terraforming makes sense or is possible)
0Send private message
12 years ago
Aug 22, 2012, 3:17:31 PM
Well, sure I can make an example.



In the StarSystemDescriptor.xml, modify the descriptor named "StarSystemClass" like this :



Note : I used the MaxSystemPopulation which is based on the addition of all colonized planet "MaxPopulation" for test purpose.



[CODE]











[I'veremovedallotherpropertyforreadingpurpose...]











[I'veremovedallothermodifiersforreadingpurpose...]







[/CODE]



In the StarSystemImprovementDescriptor.xml, modifiy the descriptor named "StarSystemImprovementIndustry1" like this:



[CODE]



StarSystemImprovementIndustry1



$(ClassStarSystem:Population) lt $(ClassStarSystem:FoodBuildingLimiter)



%StarSystemImprovementIndustry1Title

%StarSystemImprovementIndustry1Description







[/CODE]



You can first check that when you launch a game as UE and ask the SystemAI to be specialized in Industry, it will push the Industry improvement on the queue.

Then change the FoodBuildingLimiter factor from 0.6 to 0.5 or smaller and check that this time it will choose the planetary improvement and never build the industry improvement...



Did this help?



Cheers,

Flo
0Send private message
12 years ago
Aug 22, 2012, 2:27:55 PM
@ thortillas, we have been trying fairly hard to make this type of approach work, and we cannot. Can you give the actual code for a simple example? There are many places where somebody makes a general statement like, "Oh, do this and it should work". (Not just you smiley: smile). But then we try that, for many hours, and cannot make it work. If we are lucky, we post our code and the other person says, "Oh, did I forget to mention you also have to do this other thing?" and then it all works.
0Send private message
12 years ago
Aug 22, 2012, 9:27:47 AM
Ok, my fault... I said you can add some "operation" into the path prerequisites... but, after trying, crying and looking in the code, you can't.

Sorry, I was certain that we already implement this part in our interpreter...



I already made the suggestion to Loic to add more possibilities on the "Path" interpreter like basic operation (mult, add, div, etc), but don't expect them for the next build... this will need some code on our side... and we are already full of improvement... but still, this will come because I think it is a base thing to provide...



But what you can do is add some property on the system which will be used by your prerequisites... which is not so good but at least works.



So to resolve your problem, you will need to override the StarSystemDescriptor.xml and change the descriptor "ClassStarSystem" by adding a "FoodBuildingPopulationLimit" property.

Then add a modifier which set the property "FoodBuildingPopulationLimit" to what you want (basically "MaxPopulation" * 0.6).

Then add a path prerequisite which check "Population" against "FoodBuildingPopulationLimit"...



Not so elegant, but this will works...



Once again, I am really sorry about that... I was really sure about the capability to use "operation" in the path... I don't know why we haven't already implemented it...



Cheers,

Flo
0Send private message
12 years ago
Aug 21, 2012, 8:33:43 AM
Hi !



I'm just back from holidays and I bump into your question. I have another one by MP which I will answer too when I get time to... I will post it on the forum to avoid personal information.

Just to say, do not send me some MP for question, even specific ones.

When you have a question, think that you are probably not the only one with it ^^ nor that I am the only one with the answer ^^.



That said, I hope that you not already answered your own question... ^^



So, on first read, I have to say that your first AIPathPrerequistes seams correct and that normally any properties (build-in or self-implemented one's) should be accessible with the path.

What you can try is to add some parenthesis around the two part of the comparison. It will help the interpreter to understand which part is compared to the other.



For the second one, the problem is not around build-in or self implemented, but from path.

You ask him to get $(ClassStarSystemImprovement:MaxPopToBuild). But the AIPathPrerequesites start on the System you choose to build the improvement. So the interpreter cannot fit the StarSystem with the tag "ClassStarSystemImprovement" and return a 0.

Even more, the improvement is not constructed yet, so you cannot access any of his properties...



I think this is the "wrong" part...



To resume, keep going with the first path but add some parenthesis into to force operation priority (multiplication first, comparaison next).

If you have some time, try the following to see which one works :

-> 1 lt 2

-> 3 lt 2

-> $(ClassStarSystem:Population) lt 10

-> $(ClassStarSystem:Population) lt 0

-> 1 lt $(ClassStarSystem:Population)

-> 10 lt $(ClassStarSystem:Population)

-> $(ClassStarSystem:Population ) lt $(ClassStarSystem:MaxPopulation)



I will try to spare some time to test this, but I cannot promise you anything on when I will have some... sorry...



Cheers !



Flo
0Send private message
?

Click here to login

Reply
Comment