Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
New Server | HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 7 - Falcon's Last Flight > Thread: AI Scripts modding tutorialresearch
Thread: AI Scripts modding tutorialresearch This thread is 3 pages long: 1 2 3 · «PREV / NEXT»
Vildark
Vildark


Hired Hero
posted July 19, 2018 11:27 AM
Edited by Vildark at 11:46, 19 Jul 2018.

I have great news: I found the offsets needed for Trial by Fire!
According to Biopat, it may be an incompatibility between Uplay version and Steam version of the game, not Vanilla vs Trial by fire.
Anyway, little insight of what I did:



Yeah one month ago, I would have freaked out too ^^

So tonight, I should be able to play with always waiting AI
That means that I am ready to get help from you MoritzBradtke. I don't know how you want to help me. But first thing I want to fix is IA never escaping from AOE. So I would be glad if you can speed me up on this specific topic.

Quote:
It has been tested and it doesn't seem to do what's intended

That's bad. That would mean that Biopat's work simply doesn't work. And as I said before, he did a huge work, and it would be very hard to fix it. For the record, was it on Uplay or Steam version? Because again maybe Biopat's mod only work on Uplay's.

Quote:
The interrupt movement action in the whole game does not work correctly.

Yeah I was afraid of that, as it was already the case in 1.8.

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Antalyan
Antalyan


Promising
Supreme Hero
H7 Forever
posted July 19, 2018 01:27 PM
Edited by Antalyan at 13:28, 19 Jul 2018.

Amazing news indeed! It looks rather scary

It has been tested on the Steam version, I will try to personally test it on the Uplay one soon.
____________
Important H7 tips & tricks
H7 Umbramancer Project

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted July 19, 2018 05:40 PM

glad u made some Progress, i dont think I can help u with programming AI, because i have no Knowledge in Scripting, all i can do is giving u hints what could be improved, also i've only checked the Adventure map AI scripts not Combat map AI, what would be related to that trap Problem, as ive said u Need to understand the script to fix Things or u'll just break more and ist not an easy Task, Nothing i could help u with sry, u would Need Knowledge About the script language used to improve it, something i do not have, all i can do i read it and sometimes pick up Little phrases i do understand in Terms of what they do to the game but i cant find mistakes because i dont understand the language altogether

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted July 19, 2018 05:51 PM

also while Fixing the trap Problem is good Goal and would be appreciated, i dont think its one of the Major Problems of the game, u can just Change some spells and skills to avoid this Problem like ive alrdy done with my H7MOD, improvements i would like to see in the game are mostly related to adventuremapAI, like AI putting more Focus on Picking up artifacts with his main hero or AI Always Picking the same hero as its main hero and rezz this hero if he gets defeated and not choose someone else as main hero after that or AI units in Combats should use their active skills sooner and more often, stuff like that i would like to see, there are more issues like this, i can try to help u with that more complicated stuff will be difficult, i know AI uses scores to choose his Actions and there are different Actions for teh Adventure map AI but im not sure how this works together in the end, if u would just increase the score for "pickupartifact" for the main hero(AI uses different roles for the Heros, main, scout, etc) that might work but it is prob not that easy

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Antalyan
Antalyan


Promising
Supreme Hero
H7 Forever
posted July 20, 2018 09:42 AM

@vildark
I've just tested the Uplay version and the modified AI works - it always waits with the creatures, not warfare though (Uplay version, tested in duels)- that's great news indeed!
____________
Important H7 tips & tricks
H7 Umbramancer Project

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted July 20, 2018 10:39 AM
Edited by Vildark at 11:01, 20 Jul 2018.

@Antalyan: As I didn't have the chance to test my version yesterday, I am glad to hear it works With all that, we have learned a very important thing to share this mod: it is Uplay/Steam dependant!

@MoritzBradtke: Fixing AOE is very important to me. Maybe I should give you a little insight of my motivation: I play this game with my girlfriend, and one of her favorite spell is the so-called firewall. It would be very frustrated to just have to cast firewall to make IA harmless.
And if it is well code, it should be easy: I just have to make AI completely ignore AOE to begin with, like in 1.8.
As for what should be fixed, your help will be greatly appreciated, as I know this game only for 3 months, so I don't know main problems.
And I can assure you, I really want to improve adventure IA as well, because taking their not defended castle is not fun. It's like they even don't know recall and reinforcement spell.
So, as I will work on it as soon as AOE is ok, what is the first adventure IA problem I should tackle? Is it really picking up artifact?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Antalyan
Antalyan


Promising
Supreme Hero
H7 Forever
posted July 20, 2018 11:29 AM

@vildark
Exactly, the only bad thing is that we don't know what to do for people playing the game through Steam.

I personally consider the issue with moat the worst since it makes the whole siege irrelevant.
____________
Important H7 tips & tricks
H7 Umbramancer Project

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted July 20, 2018 12:45 PM

Quote:
Exactly, the only bad thing is that we don't know what to do for people playing the game through Steam.

I am on steam. So if what I did work for me, problem solved. That's what I have been working on for 2 weeks. I just thought that what I was doing was for Trial by fire. But actually, it is for Steam.

Quote:
I personally consider the issue with moat the worst since it makes the whole siege irrelevant.

I agree it's a major bug. But I disagree with your conclusion. In which condition would you want to cross the moats? There are walls anyway.

Anyway, first I fix AI AOE. Then I will fix moats as it seems easier than adventure IA. And then I will work on adventure IA.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
lordgraa
lordgraa


Promising
Famous Hero
The Whisperer
HC SUPPORTER
posted July 20, 2018 01:37 PM

One thing I have noticed: uPlay latest version and Steam latest version of H7 editor have some minor differences.

The "visible" one is the new button for publishing map on Steam workshop but I have suspicion there are more (that Limbic did some small changes before they released the last Steam version of the editor).

I will keep my eyes open, those changes could be just in the source code or Kismet scripting language.

And good job everyone who is trying to fix this bad AI!
____________
World of Heroes (Czech fansite)
Wryn Pendragon: Umbramancer (H7 community project)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted July 20, 2018 08:22 PM
Edited by MoritzBradtke at 20:30, 20 Jul 2018.

that is fine, it is ure personal Project in the first place and u can Change the AI as u like, i would just like to Point out that my MOD, which u can find here -> http://www.hommdb.com/mods/heroes7/h7-improved/
changes most AOE spells and skills but not all yet, f.e Firewall only stays up 1 round instead of 3, so AI will no longer be helpless cause it will be trapped max 1 turn, u can balance spells by altering mana Costs, Damage, Duration and Kind of "fix" These AI Bugs, it is not rly a fix but a Workaround, what does the Job as well, so do i think at last, therefore i think there is not rly Need to fix this but if its easy i guess go ahead, also i've heard, doesnt mean ist true, that this bug has been caused by AI being more careful when approaching the enemy, therefore it wont run into the enemy straight, what is a good Thing since the AI wont be killed so easily usually(not Always the case but well), Kind of suprised u think Fixing it will be easy without Breaking something else but good luck (: Maybe im just having too much respect when Looking at this Task,

About Adventure map AI, it happens AI kills stuff with his main hero, opens paths, f.e when killing an army at an teleporter, now there is an good artifact behind the teleporter but AI just goes back, later some other weak hero will pick it up and run around with it and AI will never trade artifacts, that could Need a fix, yes, artifacts are very powerful in the game and can Change a lot, also AI should put more effort in Recruiting his main hero again if he is dead and put him back as main hero as well, it diesnt do that atm, if hes is dead, eventually will never come back AND another weaker hero will replace him

edit: ai uses instant recal sometimes

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
vildark
vildark


Hired Hero
posted July 21, 2018 12:37 PM

Thanks for support lordgraa

You sure have some experience with AI MoritzBradtke. Indeed, in 1.8 IA ignore AOE AND melee unit range. I'll see if it's the same function or not
Ok good thing IA know recal. It will be easier to make them use it.
Concentrate artifcats on main hero ok.
As for not recruiting main hero again, I have seen it too. But, if IA lose it's main hero, it's often already losing. So I will not make it a priority.

For info: I tested IA mod yesterday and it finally works for me!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Moritzbradtke
Moritzbradtke


Known Hero
posted July 21, 2018 03:31 PM

U could say so but if u fighting a tough AI sometimes u win close and are very weakend, now u can Restock and finish the ai what will be easy if it cant defend properly and a lv20 hero will do much better than a lv4 but maybe ure right and it is not that important, something else, AI doesnt visit towns with his Main hero usually and therefore Dienst learn spells, not sure about shrines, however ive started to give hereos more default spells to improve THW Situation for spellcasters so i guess that works AS well but i need to change all Hereos for it, i think it would be Vetter if u improve AI behaviour where there are no other solutions but im just giving hints, bzw AI can use teleporters fine but sometimes it uses EM to See there is something and then just goes back without picking up stuft, f.e with Main hero artifacts but later someone else will do it another hero

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
vildark
vildark


Hired Hero
posted July 21, 2018 11:05 PM
Edited by vildark at 23:35, 21 Jul 2018.

Not a priority, but I'll look into it. I really want to make AI interesting.
Anyway, I started to look into it, and maybe I was little too optimistic. Because I came across this:
Quote:
native function int GetReachableCells(int movementPoints, out array<H7CombatMapCell> reachableCells);

According to Biopat, native function can't be changed :/
That can't be good right?
I'll try to find some workaround. And I have another card up my sleeve: I can compare with 1.8 implementation

Edit: By any chance, do you know how to add some logs in code?

Edit 2: H7AIActionMoveCreatureStack 1.8 VS 2.2



THAT should be good right?
Ok ok, I'll stop spamming here, and post only if I make some progress

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted July 27, 2018 10:07 AM
Edited by Vildark at 10:08, 27 Jul 2018.

Hello,
I said I would post if I make some progress.
Well I didn't really make some, but I achieved my first hook on WilStackPassThroughHostileAuras. And I added logs around it too. Too bad it wasn't the culprit.

And I should have known, because I have discovered that, not only IA stay in firewall, IA want to get in firewall!
And it's not like they can't go anywhere else, because if firewall is already full of enemies, IA go elsewhere.

So now I have to find why IA want to get in firewall, like it is a positive buff or something.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
athos
athos


Adventuring Hero
posted July 27, 2018 01:11 PM

Very interesting and disturbing report. How could a game AI be shipped with that rubric?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Antalyan
Antalyan


Promising
Supreme Hero
H7 Forever
posted August 11, 2018 06:20 PM

@Vildark
I know you said you'd post... but still, any progress?
____________
Important H7 tips & tricks
H7 Umbramancer Project

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Promising
Supreme Hero
Modding the Unmoddable
posted August 11, 2018 10:56 PM

Quote:
Very interesting and disturbing report. How could a game AI be shipped with that rubric?


Probably there are more and less desirable spots, and they messed up how to code each, so Firewall makes a spot more desirable instead of less.
____________
Discover H4 Greatest Mod!
https://www.moddb.com/mods/greatest-mod/downloads
(Also biggest of only two 2 mods for HOMM IV)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vildark
Vildark


Hired Hero
posted August 20, 2018 11:39 AM

Hello,
I was on holiday, so didn't work on it much.
Still, I was working on RunScores function (calculate a score for each cell if I am right). It is the one calling WilStackPassThroughHostileAuras.
I found how to get real time log and c++ debug.
Now I think I will try to call my own RunScores function and log some informations to understand how this function works.

As fixing this bug takes more time than I thought, I think I will use MoritzBradtke's mod for my firewall problem, and begin to look into adventure AI.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
vildark
vildark


Hired Hero
posted November 01, 2018 12:35 PM
Edited by vildark at 12:42, 01 Nov 2018.

As I don't make good progress, and it is very painful, I am pretty discouraged.
So I have sent this email to Biopat.
But I didn't get an answer this time, so I post it here for the record.

I think I need some documentation.
I am working on the C++ part of the hook. I have read what you have done and I mainly understand it and I am able to reproduce it.
But what I don't get is how did you find how to do it. Did you have some examples? documentations?

Anyway, what I want to do is preventing IA from running in fire by writing my own RunScores function:
UC: RunScores( H7AiCombatSensors sensors, H7Unit currentUnit, out array<AiActionScore> scores ).
C++ (From SDK): void RunScores ( class UH7AiCombatSensors* sensors, class AH7Unit* currentUnit, TArray< struct FAiActionScore >* scores );

First I hook the function like you did:
void Init_Hooks()
{
   // new HookFunctionToCallback("Function MMH7Game.H7LoadingHints.InitHints", InitHintsFunc);
   new HookFunctionToCallback("Function MMH7Game.H7AiActionMoveCreatureStack.RunScores", RunScoresMyH7AiActionMoveCreatureStack);
}


So now, my C++ function RunScoresMyH7AiActionMoveCreatureStack() is called when default RunScores should be called:


// UC: RunScores(H7AiCombatSensors sensors, H7Unit currentUnit, out array<AiActionScore> scores).
// C++ (From SDK) : void RunScores(class UH7AiCombatSensors* sensors, class AH7Unit* currentUnit, TArray< struct FAiActionScore >* scores);
int RunScoresMyH7AiActionMoveCreatureStack(__int64 This, __int64 Stack_frame, void* pResult)
{
   // Should I get my function parameters from there? How?
   FFrame* pStack = (FFrame*)Stack_frame;

   // the context of my function
   UH7AiActionMoveCreatureStack *aiActionMove = (UH7AiActionMoveCreatureStack *)This;

   // Put my function in pRunScores
   static UFunction* pRunScores = NULL;
   if (!pRunScores)
       pRunScores = (UFunction*)UObject::FindObject<UObject>("Function mmh7aimod.MyH7AiActionMoveCreatureStack.RunScores");

   // Define my function parameters?
   ModObjectBuilder_execRunScores_Parms *fParams = new ModObjectBuilder_execRunScores_Parms();
   // H7AiCombatSensors sensors
   // H7Unit currentUnit
   // out array<AiActionScore> scores
   
   // Call to my function
   aiActionMove->ProcessEvent(pRunScores, fParams, NULL);

   // Use of the result of my function?
   // memcpy(&scores, &fParams->scores, sizeof(fParams->scores));

   // Avoid call to original function?
   // return 0x????????;

   int retval = ((ProcessInternalPtr)OriginalProcessInternal->get())(This, Stack_frame, pResult);
   return retval;
}



My questions are:
- How do I define my function parameters?
- How do I use/inject the result of my function?
- How can I avoid calling the original function?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
MoritzBradtke
MoritzBradtke


Known Hero
posted November 07, 2018 02:31 AM
Edited by MoritzBradtke at 04:03, 10 Nov 2018.

nice to see u are still working on it, wish u best luck u gonna get some help (: would be nice to see some Kind of AI mod

something else: as u probably are somewhat skilled with AI modding, i have a Question u may be able to help with, as im working on my mod to improve the game, i'm also Looking at active abilities for creatures, a somewhat interesting Topic...

i have some Questions, i alraedy have checked some scripts and it seems that every spell in the game, every Action has some Kind of module that defines if and when it will take Action by the AI, so if i create a new ability or want the AI to use something that it doesnt currently, what would u have to do?

f.e the scatter shot of the lizardman unit, it seems they didnt add this ability, the AI never uses it, do u think  it is possible to make it work? i know the AI can use some active abilities, ive seen it using some nova or aoe damaging skills, even feral charge sometimes

or when i create a new hero spell and want to add it to the libary of spells the AI can choose from

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0535 seconds