The Prince 1.3

Upload your latest creations here.
Please note that by posting comments to posts in this forum you forfeit your personal copyright on whatever you post. AI Scripters reserves the right to re-use objective comments in script reviews without requiring the posting author's permission. Credit, where appropriate will be given in such cases.
Post Reply
User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

The Prince 1.3

Post by FireBall37 »

Hello everyone, I have to been looking forward to putting my ai on the Script uploads page for a while now.
I am close to finishing version 1.3 on my ai, The Prince. Both my brother and I use the name FireBall37 for this site. We both are working on making our own ai's .
I am hoping to upload the The Prince 1.3 maybe within the next month. :D
author of the Shadow AI and Snippets

User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: The Prince 1.3

Post by Leif Ericson »

Nice! Looking forward to seeing the new AI.

User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: The Prince 1.3

Post by FireBall37 »

I have had a few bugs and set-backs with The Prince so I don't think he will be ready to be put on this month or ever.
I have to work out several things about flush micro, strat picking conditions, and deer luring. between those I don't think I will be able to put it on. If someone wants to see his dark-age playing(without deer luring) I could put on a primitive version of The Prince. I have been doing this :head trying to get him ready but I ran into too many problems. Sorry for those who were looking forward to seeing him, (Leif Ericson). :(
author of the Shadow AI and Snippets

User avatar
Esty
Waheguru
Posts: 1159
Joined: Wed Dec 30, 2015 7:37 am

Re: The Prince 1.3

Post by Esty »

How is the prince going on ? You can share it with me and feel free to ask for tips.
Author of TRiBaL_Warrior, Yggdrasil, PharaoN, WoodyWood Pecker and currently :o dette :dance

User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: The Prince 1.3

Post by FireBall37 »

I have not been working on The Prince for a couple weeks because several things about him were not working out but I think I will start again soon. Besides that he is getting along very well. I tried to make deer luring and sheep scouting for him but they did not work out so I am just going to leave them be for now and work on more important essentials. Thanks for asking how he is doing. :D When I start working on him again I will ask you some questions about problems I have been having. At the moment I am working on setting strategies on the feudal-age. Happy scripting! Also MERRY CHRISTMAS!
author of the Shadow AI and Snippets

User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: The Prince 1.3

Post by FireBall37 »

Hey Esty, thx for the offer to help! I have been having a lot of trouble with boar hunting. I had tried borrowing from an older Barbarian, but I'm not satisfied with the way it worked. I never really understood it, so I didn't know how to adjust stuff. <_<

So I was wondering, do you think hunting using the sn's is better, or pure DUC? Which is simpler to use? Thanks!
author of the Shadow AI and Snippets

User avatar
Esty
Waheguru
Posts: 1159
Joined: Wed Dec 30, 2015 7:37 am

Re: The Prince 1.3

Post by Esty »

The easiest way is of course the use of the sns. But because it is easy, it makes the boar luring "out of control" :
- when the conditions requiered to start the boar-luring are here, it sometimes won't trigger immediately.
- the second boar can be lured way too early after the 1rst boar to have been lured.
- and most of the time, the 2nd boar is lured when the first boar is completely eaten, which is not what we want.

In fact, we want the 2nd boar being lured when the 1rst boar is 85-90% eaten.

The basic would be :
(defrule
(civilian-population > 10)
(up-research-status c: ri-loom >= research-pending)
=> (set-strategic-number sn-enable-boar-hunting 2)
(set-strategic-number sn-minimum-number-hunters 6)
(set-strategic-number sn-minimum-boar-hunt-group-size 6)
(set-strategic-number sn-minimum-boar-lure-group-size 1)
(set-strategic-number sn-maximum-hunt-drop-distance 30)
(disable-self))

For a better control, forget the sns : you definitely need some direct unit control (DUC) to do the stuff correctly. Below, this is a code which can be helpful to understand hos things work.

; 1 = you need a goal reset to zero at the beginning of ur script
(defrule
(true)
=> (set-goal split-rule-goal 0))

; 2 = you need a goal to save the amount of food left, checked each rules past
(defrule
(true)
=> (set-goal boar-food-left -1))

; 3 = you found a boar and you verify the amount of food remaining
(defrule
(up-compare-goal object-id-goal != -1) ; a boar is saved as an object (see rules below)
(or (unit-type-count villager-class >= 10)
(and (unit-type-count villager-class >= 8)
(unit-type-count sheep <= 1)))
=> (up-full-reset-search)
(up-set-target-by-id g: object-id-goal) ; focus on the object
(up-get-object-data object-data-carry boar-food-left)) ; check how many food is remaining

; 4 = we check if a boar exist around our TC, at a distance < 33 tiles
(defrule
(or (unit-type-count villager-class >= 10)
(and (unit-type-count villager-class >= 8)
(unit-type-count sheep <= 1)))
(dropsite-min-distance live-boar < 33)
(or (unit-type-count-total villager-hunter == 0) ; this condition is for your first boar
(and (up-compare-goal boar-food-left c:<= 120); this condition is for your second boar
(up-compare-goal boar-food-left > -1)))
=> (up-full-reset-search)
(set-strategic-number sn-focus-player-number 0) ; focus on gaia
(up-set-target-point self-point-x) ; research the distance between 6 to 32 tiles from your TC
(up-filter-distance c: 6 c: 32)
(set-goal split-rule-goal 4))

; 5 = we save the boar as an selectable object
(defrule
(goal split-rule-goal 4)
(up-find-remote c: boar-class c: 1) ; if you find a boar
=> (up-remove-objects search-remote object-data-carry < 1) ; and the boar does contain food (object-data-carry)
(up-set-target-object search-remote c: 0)
(up-get-object-data object-data-id object-id-goal)) ; save the object in a goal

; 6 = we need a villager
(defrule
(up-compare-goal object-id-goal != -1)
(up-object-data object-data-action != actionid-attack) ; if the object is not attacking, it means that its not already lured
=> (up-reset-search 1 1 0 0) ; reset the local searchs (1 1), not the remote searchs (0 0) to keep the remote boar in memory
(up-reset-filters)
(up-set-target-point self-point-x)
(up-filter-distance c: -1 c: 32)
(up-find-local c: villager-class c: 1)) ; select a villager to lure

; 7 = if the villager is weak, we look for another one
(defrule
(up-set-target-object search-local c: 0) ; a villager is found, but does it have enough HP ?
(or (and (up-object-data object-data-hitpoints < 40)
(up-research-status c: ri-loom >= research-pending))
(or (up-object-data object-data-hitpoints < 25)
(up-object-data object-data-action == actionid-build))) ; if it is a weak villager or if it is a villager builder,
=> (up-reset-search 0 1 0 0) ; we search for another villager, removing the first one found (0 1)
(up-find-local c: villager-class c: 1)
(up-jump-rule -1)) ; we repeat the rule until a high HP villager is found

; 8 = The coditions are reached, it's time to lure the boar
(defrule
(unit-type-count villager-class >= 8)
(up-timer-status luring-timer != timer-running)
(dropsite-min-distance live-boar < 33)
(up-compare-goal object-id-goal != -1) ; the object stile exists
(up-object-data object-data-action != actionid-attack)
(up-set-target-object search-local c: 0) ; we have our villager selected to lure
=> (enable-timer luring-timer 10)
(up-reset-filters)
(up-remove-objects search-local object-data-tasks-count > 0) ; we ask the villager to attack the boar until he is targeted
(up-set-target-by-id g: object-id-goal) ; we target the boar
(up-target-objects 1 action-default -1 -1)) ; let's go !

; 9 = we reset the timer
(defrule
(timer-triggered luring-timer)
=> (disable-timer luring-timer)) ; the timer is ready for another time

After those steps, you will need to ask your villagers to attack the boar which is lured to your TC, for this, use your shepherds, your hunters, your food-gatherers, and remove the villager being targeted by the boar with object-data-tasks-count. You can research around your TC from a distance between -1 and 6. If the object is found, attack it. The timer can be used again for this step, to prevent your villagers to have unexpected behaviour during this step.
HF GL
Author of TRiBaL_Warrior, Yggdrasil, PharaoN, WoodyWood Pecker and currently :o dette :dance

User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: The Prince 1.3

Post by FireBall37 »

Thanks for putting so much work into the reply Esty! I will look at this a lot :D I was a bunch of trouble with the sn's, so DUC will be way easier.
Esty wrote:
Sat Jan 02, 2021 2:21 am
=> (up-reset-search 1 1 0 0) ; reset the local searchs (1 1), not the remote searchs (0 0) to keep the remote boar in memory=> (up-reset-search 0 1 0 0) ; we search for another villager, removing the first one found (0 1)
I was especially glad to see the explanations for (up-reset-search). I have seen that in a lot of code, but the UP Reference didn't explain it very well. Hopefully I can use it now to make my life easier!

Thanks again, more questions coming! :D
P.S. Where would be the best place to ask questions about problems in general? I don't know a bunch about how this forum is organized.
author of the Shadow AI and Snippets

User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: The Prince 1.3

Post by FireBall37 »

Hi again Esty! I have a question about group micro stuff. I haven't worried about it up to now, but I need it to make my flush work really well.
I don't really know anything about the group micro commands lol so here's hoping you can shed some light on it. I've seen that you've used it for Tribal, Pharaon, etc.

This is what I have right now, instead of control groups:
1: first ranged unit produced is set as leader(save his id)
2: when attacking, all units far away are sent toward the leader's position
3: for micro, all ranged units within a certain distance of the leader are tasked together with formation-line etc.
4: if the leader gets below a certain hitpoint level, a new leader is set

I'm wondering, will this system work well, or will it be much more difficult than using control groups??????

PS Thanks for helping! But I know you are busy, so I don't want you to use all your time answering my questions! :lol: Can you suggest anyone else that might be willing to help too?
author of the Shadow AI and Snippets

Post Reply