[PULL REQUEST] ZScript Monster AI exports

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: Developers

[PULL REQUEST] ZScript Monster AI exports

Postby phantombeta » Fri Dec 07, 2018 12:41 pm

PR link
Exports P_CheckFor3DFloorHit and P_CheckFor3DCeilingHit to ZScript, and adds a function for triggering monster use/push specials to circumvent not being able to access the spechit array when writing custom monster AI.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_

Re: [PULL REQUEST] ZScript Monster AI exports

Postby Graf Zahl » Fri Dec 07, 2018 1:33 pm

What are you doing here? This is all extracting code from the innermost logic of the engine.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [PULL REQUEST] ZScript Monster AI exports

Postby phantombeta » Fri Dec 07, 2018 2:03 pm

Graf Zahl wrote:What are you doing here? This is all extracting code from the innermost logic of the engine.

I need P_CheckFor3DFloorHit in my AI to handle drop-offs, and thought I might as well export P_CheckFor3DCeilingHit.
As for CheckMonsterUseSpecials, I need such a function in my monsters' custom AI and movement code so they can reliably open doors and trigger lifts. Otherwise, all this code I wrote is literally useless.

Basically, I'm using custom AI to make monsters smarter, and so I can have a much better invisibility powerup, along with using custom movement code so monsters navigate better instead of getting stuck bouncing between walls all the time. This involves making monsters move in way more directions than 8, which means I can't use TryWalk or MonsterMove - and without those or CheckMonsterUseSpecials, monsters are quite useless, as they can't activate doors and lifts.
(Basically, CheckMonsterUseSpecials exists for the same reason I wanted to export the spechit array.)
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_

Re: [PULL REQUEST] ZScript Monster AI exports

Postby Apeirogon » Fri Dec 07, 2018 2:20 pm

phantombeta wrote:movement code so they can reliably open doors and trigger lifts

A_wander with no random turns flag no longer work for this? I remember I use this in decorate for LCA addon.
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: [PULL REQUEST] ZScript Monster AI exports

Postby phantombeta » Fri Dec 07, 2018 2:23 pm

It'll mess with my own movement code, so no, it wouldn't work.

Edit: As a note, it doesn't make much sense not to merge the exports for P_CheckFor3DFloorHit and P_CheckFor3DCeilingHit IMO - P_CheckFakeFloorTriggers was exported to ZScript, and that's pretty much the same thing, just for fake floors.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_

Re: [PULL REQUEST] ZScript Monster AI exports

Postby Major Cooke » Fri Dec 07, 2018 9:09 pm

I could definitely use this myself.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007
Discord: Major Cooke#0846

Re: [PULL REQUEST] ZScript Monster AI exports

Postby Graf Zahl » Sat Dec 08, 2018 5:41 am

Ok then. Looking through this PR I'd still like to request one change: To keep the code clean and the exports out of the way I rewrote larger parts so that the exports do not contain any real work code and are relocated to vmthunks.cpp/vmthunks_actor.cpp.

This should follow the same rules and also define the called functions as direct native variants. Just be careful with bool returns, they get rejected by the macro and need to be changed to int.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [PULL REQUEST] ZScript Monster AI exports

Postby phantombeta » Sat Dec 08, 2018 12:05 pm

Alright, gonna do that right now.
By the way, since that isn't really obvious, could you put that somewhere so other people can see it? I don't mind doing a bit more work just to make sure my PRs get in, but I imagine other people would like to know this.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_

Re: [PULL REQUEST] ZScript Monster AI exports

Postby Graf Zahl » Sat Dec 08, 2018 12:47 pm

Sure, but only after the release. Now it makes no real sense.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [PULL REQUEST] ZScript Monster AI exports

Postby phantombeta » Sat Dec 08, 2018 1:17 pm

Okay, PR updated. I force-pushed the changes so there's still only two commits.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests