Latest Posts

Topic: News about AI

Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-03-21, 17:50

Yes, if the tribe had only 1 trainingsite, such default would totally prevent building second and further trainingsites.

If you provide functions like "get_trainingsite_type()" that basically reads config file, it would be great.

BTW, we can remove basic and advanced category of trainingsites, or I myself can remove it later, because that will need modification of AI and it would be complex for you.

What is dilema is whether your code should be ported to both trunk or just my branch. I am still not sure my branch will be good enough to be merged to trunk...


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-03-21, 20:59

I'd say let's have a separate branch and merge it into trunk when it's ready, because it will be an improvement in any case. Then you can merge it back into your experimental branch.

get_trainingsite_type() - we already have that covered with get_building_descr() both in the Tribe and Tribes classes. You can then query for type() == TRAININGSITE or do an upcast. Or do I misunderstand and there is something else that you need?


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-03-22, 06:54

It would need some rething and redefine how trainingsites are built, so it is not matter of a simple merge. And it would be double work if we decide to include my branch later, because implementation in mine branch must be different. But if my branch will be not merged, I will eventually merge your branch to the trunk, of course....

My idea was that we are talking about some function like get_trainingsite_proportion() that AI will be able to call for a trainingsite (description) and which will by default return values from conf files, and if none, it will return your calculated values. From AI perspective it does not matter where the number will come from, it just need (would need) that number....


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-03-22, 13:30

I'll create a branch and then I'll leave it up to you what will be the best use of your time face-smile.png


Busy indexing nil values

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-03-23, 07:41

The branch is ready.

I decided to go for percent values so that we won't have to deal with floating point arithmetic. This means that they will now sometimes add up to a bit less than 100% due to rounding errors, but I guess we can live with that?

There is also a new convenience function trainingsites() in TribeDescr, I don't know if it's useful to you.


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-03-23, 10:58

GunChleoc wrote:

The branch is ready.

I decided to go for percent values so that we won't have to deal with floating point arithmetic. This means that they will now sometimes add up to a bit less than 100% due to rounding errors, but I guess we can live with that?

There is also a new convenience function trainingsites() in TribeDescr, I don't know if it's useful to you.

You are pretty fast! But sum under 100% is not good, f.e. scenario:

trainingsite1 49%
trainingsite2 49%

would lead to deadlock once there is 1+1 trainingsites built. It is quite fine to go over 100%, f.e.

trainingsite1 55%
trainingsite2 55%

would do no harm...


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-03-23, 11:04

So I did a benchmark 1:1 comparison - my branch (topleft) vs trunk (bottom right)

The results are not catastrophic but not good enough. Now I wonder if my branch creates new soldiers at all. I must find the root couse of this somehow. Or it is "generally bad"? - it is also possible,.

Screenshots with hours inrervals





Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-03-23, 12:32

You are pretty fast!

Well, it happens to be a part of the code that I know pretty much in my sleep now face-wink.png

But sum under 100% is not good, f.e. scenario:

Fixed - rounding up now. Tested that Empire without any predefined percentages will now end up with a sum of 102%. I have also added some more error handling in TribeDescr - feel free to change as you need.


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-03-23, 12:35

Great, I will incorporate that into my branch soon, but first I must investigate the creation of new soldiers in my branch....


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-04-03, 11:38

@Gun

I merged your branch but I always get 255 (I changed int to uint8_t) when no entry in lua conf file. No big deal for now, but I would appreaciate you look at this....


Top Quote