Scripts / Respawning with new AI

Author
Message
Bolt Action Gaming
GameGuru Tool Maker
10
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 27th Oct 2018 18:26
Per Lee's request I'm putting this on the forums here for everyone to see as well as so he can jump in on as well.

Email is as such:
So I've got a project that's been sitting on the sidelines for months - a 'roguelike' toolkit that randomizes spawns, teleports, etc. One thing I *CANNOT* do is respawn enemies however. I have randomized their spawns sufficiently but the actual respawning of them after dying with the new AI module system seems impossible.

Shy of using the old AI system in lua, is there a way to implement this?


So guys, lets put our noodles together.
I recently had a thought with respect to this, notably could we maybe use something like ai_soldier_exit() to 'reset' the entity?

Anyone else have any ideas?

Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 27th Oct 2018 19:49
Can you not edit the ai so that in the init it creates a table with its starting xyz position, then in the exit fubction instead of destroying the entity, reset its health back to full and transport it to the coordinates in the table?

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 28th Oct 2018 22:02
@Belidos : Agreed, this is the type of solution I would do for the respawn, though instead of using the exit, perhaps inflate the health to 1000+ and when it drops below 1000 treat that as the trigger to respawn with the original init positions and states. Anyone else have anything to pitch into a possible solution for the above?
PC SPECS: Windows 8.1 Pro 64-bit, Intel Core i7-5930K (PASSMARK:13645), NVIDIA Geforce GTX 980 GPU (PASSMARK:9762) , 32GB RAM

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Oct 2018 23:14
Hi Lee, several of my old scripts relied on ordinary entities having scripts being 'always' active but something you've changed recently now means that if they get damaged such that their health reduces to zero the scripts no longer get called. I can fix this by just adding a call in the init function to set their health to some ridiculous value but could you maybe look into this, either have a way of specifying that an entity can't take damage or maybe restrict whatever you did to characters? (I assume it has something to do with the pre-exit changes you made for the ai )

As to respawning, I've adapted smallg's respawn scripts and they still work fine with custom characters that don't use the new ai modules.
Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Oct 2018 00:29
I did pretty much what Belidos has mentioned a few years back with the ogre from the fantasy pack. The only difference being, I allowed it to die then re-spawned it afterwards on a timer. It was rough and ready, but worked as far as it goes. He re-spawned every 10 seconds at his initial spot when killed, if you were close enough or thereabouts. If I can find it out I'll post some info. Again not the soldier scripts, but it should work in a very similar fashion.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Bolt Action Gaming
GameGuru Tool Maker
10
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 29th Oct 2018 14:08
Thanks guys. I'm not sure if Belidos's fix will work for what I'm doing but it might get me there.

So you're essentially saying on init for the AI, store the x/y/z values for the character, health... hm. Is there no single 'death state' in the AI code, or is that the _exit code?
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 29th Oct 2018 16:41 Edited at: 29th Oct 2018 16:49
Quote: " I have randomized their spawns sufficiently but the actual respawning of them after dying with the new AI module system seems impossible."


Ive been having tremendous issues with this exact issue. Thank you bolt for dialogue up. I've encountered many strange bugs as well trying to implement with legacy AI too where it would seem more easier to attempt.

I was finding once a character ragdolled all kinds of bizarre and unpredictable things were happening in my attempts to get them to respawn to either their starting position.

Quote: "though instead of using the exit, perhaps inflate the health to 1000+ and when it drops below 1000 treat that as the trigger to respawn with the original init positions and states. Anyone else have anything to pitch into a possible solution for the above?"


I've had zero problems with respawning before ragdoll, takes effect (using health tricks like that). Its just not very ideal as they vanish like a ghost after you headshot them. And if i were to avoid ragdoll and use an animated death, it just feels very late 90's early 2000.

Maybe an addition to the setup.ini to include the when enemies die and "vanish" they are not actually removed from the map entirely. Just hidden? I'm not sure how complicated this process would be to implement. Or maybe there is a better internal solution others can think of or Lee? I think if we do allow for enemies to still be "alive" while ragdolled it would add a whole new level of interactivity. For instance body looting and Preben's GG Loader AGK video showing body flinching when shot after dead and ragdolled.

I do like that enemies disappear after a certain time when the player is not looking at them. But its unfortunately there is no way to bring them back on to the map after this takes place during the engines exiting process.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Oct 2018 19:37 Edited at: 29th Oct 2018 19:37
My old script worked fine with ragdoll from what I can remember. I'll see if I have a video I can upload. It took hours of testing and trial and error before it did though!
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 29th Oct 2018 20:57 Edited at: 29th Oct 2018 20:59
The issue I have though with trying to work within the exit process, is you have a very short time frame to attempt to recover the NPCs before the engine removes them entirely from the map.



For example, the enemies here when they die , disappear within seconds within view of the player. For some this might be sufficient however its not ideal for me personally. With Game Guru I do like that enemies disappear when the player isnt looking at them for a period of time but its unfortunate they are completely removed off the map once that happens. Issue is once the enemy ragdolls you are really running on a clock that could eliminate them entirely.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Oct 2018 21:20
Here's the video. I intentionally sped up the re-spawn speed when I did this, but it would be possible to increase it and even stop it if you are too close to the re-spawn point.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Oct 2018 21:37 Edited at: 29th Oct 2018 21:51
With apologies to slaur3n here is a video of the respawning scripts I adapted from smallg's originals for his cowboy game:



The characters are custom ones, the ai is adapted by me from the originals that came with the model and is similar to the old-style GG ones except that there is only one script shared by all characters and the name of the character determines behaviour.

Is this the sort of thing you are after?
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Oct 2018 21:48
if you're using the public preview you need to be using the preexit(e) function to do the core of the work for this sort of thing, exit(e) is only called once now.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Oct 2018 21:50
Funnily enough I don't use either.
Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Oct 2018 22:12
Shouldn't be too hard to change where the code is placed I would imagine I have only looked at the new AI scripts a little of late to help a request to hide the player, so certainly not an expert with them. The trick here is to control the spawns from the start and keep control with a little script I attached to a floor object. It is still rough and ready and literally spawns the exact object again, but could be updated to work with an ID.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 30th Oct 2018 19:37 Edited at: 30th Oct 2018 19:38
If anything it would be nice if GG had the ability to use entity fade in and out calls. Similar to Bethesda's engines they use (Actor Fade). for fading entities out when they are in the distance rather than popping them in and out with show and hide. This would be helpful so when enemies die and we are using respawning methods where they player would be looking at the dead body disappear... it will fade out rather than teleport instantly out of view.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Oct 2018 20:09
@ Teabone. Perhaps it would be worth mentioning this in the AI thread? You never know it might be added at some point
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Oct 2018 18:31
indeed, shout at preben and maybe he can make it into a shader for you - or a dissolve shader perhaps.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-04-26 10:31:14
Your offset time is: 2024-04-26 10:31:14