Announcement: Why not try our official idea generator for inspiration when making puzzles?


Caravel Forum : DROD Boards : Architecture : A snake (I scripted one)
New Topic New Poll Post Reply
Poster Message
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged

File: 2019 05 08 - Hydra testing.hold (19 KB)
Downloaded 1 times.
License: Public Domain
icon A snake (+4)  
Do you ever get bored?

I do, and sometimes I start building things in DROD. I managed to build a fully functional snake from general npc-segments that automatically assemble themselves and start following each other after being placed in the desired shape in the editor.

The script has to be tweaked and tested and optimized, so I can't show it yet, but it works reliably, I'm sure about that now.

So what snake is it? An orange one. And it's the logical conclusion of 'not stab-able', 'tail-stab-able', 'head-stab-able'. The orange snake can only be stabbed at the middle segments. And then it makes two snakes! Isn't that wonderful?

Anyway, in finalising this, I need to decide on movement. I have deliberately build a more direct snake movement for now. No V/H preference and just coming after you and reverting to NWES preference when it can't move towards the player. However, would it be nice to have a 'normal' snake? It would be quite doable to script the standard snake movement, although brained management would be not realistically possible without introducing very sophisticated messy scripting.

So what do you think?

What movement would be cool?
Any other ideas for functionality of interactions?

And what should be the name? It could be called a divider, evil twin of the adder :)

Edit: Hydra is the name. Example level (only showing interactions) attached.
Also: Mike Rimer was so kind to give me permission to use the snake sprites as a basis for the graphics. It looks very cool and officially DROD now!


____________________________
Autocorrect is not my friend. Apologies for the typos.

[Last edited by Dying Flutchman at 05-12-2019 08:55 AM]
04-26-2019 at 09:04 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 771
Registered: 06-13-2015
IP: Logged
icon Re: A snake (+1)  
Hmm, sounds like the vague concept I had for a "Hydra" enemy a long while ago, but I never had any clue how to actually make it function.

Maybe you could make this be the one snake that actually always moves toward the player instead of having a weird dependence on the threat clock number and, thus, scenarios where the player's to its WEST but it moves EAST instead (or whatever things like that happen with real snakes)? I suspect this behavior would be far easier to put into drodscript than "normal" snake behavior anyway.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 04-26-2019 10:19 PM]
04-26-2019 at 10:18 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (0)  
Well, the complexity is manifestly not contained in defining the movement rules, but really in establishing for each npc to which snake it belongs, and in what position relative to the head. Out would be easy for a 'hard coded' snake that you tweek by hand for each room. "But we don't need no snakes that need them segments tweek'd," as old Joe used to say. "We must have versatility in placing those monsters, boy."

So now they're general snake segments sorting themselves out. Will share the code on the forum in a couple of weeks for you to criticize and abuse :)

And I'll count your reply as a 1up for movement that actually tends to bring the snake towards you. That should at least be pretty easy to get used to for players. But be warned. Already, I have seen that even with simple movement, snakes tend to go into weird orbits, simply because they want to keep moving and block their own possible options for doing so.



____________________________
Autocorrect is not my friend. Apologies for the typos.
04-26-2019 at 11:08 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Chaco
Level: Smitemaster
Rank Points: 3260
Registered: 10-06-2005
IP: Logged
icon Re: A snake (+1)  
The classic question for "body-stabbable" snakes: what to do about 2-long snakes? Are they required targets that you just can't kill by stabbing anymore? Can you specifically stab 2-long snakes somewhere non-middle just so they're killable? Or does a 2-long segment just get chopped off and die without becoming a fresh snake (much like, presumably, a 1-long does)?

Otherwise, having a new movement type to manipulate wouldn't hurt.

____________________________
Quick links to my stuff (in case you forgot where it was):
Click here to view the secret text

04-26-2019 at 11:26 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
mauvebutterfly
Level: Smiter
Rank Points: 428
Registered: 05-03-2015
IP: Logged
icon Re: A snake (+1)  
My preference would be for it to have standard snake movement rules. As for 2-tile snakes, I don't think they should be possible to kill with the sword, and some other method like bombs or bridges would need to be used. This would make even-numbered snakes unkillable without architecture.

Hydra seems like an appropriate name. Worm would also work, since those can sometimes be divided, right?

____________________________
106th Skywatcher
04-27-2019 at 02:42 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 771
Registered: 06-13-2015
IP: Logged
icon Re: A snake (0)  
One problem with making "normal snake" behavior is the requirement for it to be dependent on the threat clock. Which means every room it's in has to have a separate entity keeping track of "when" it is for it. Maybe it doesn't seem like much, but that bit of overhead is sort of annoying for architects using a custom element to always need to remember.

I vaguely remember, separately, the concept of a "worm" type snake where it can freely "decide" which of its ends is a head--so, if it's stuck in a dead end it can just swap directions and walk back out again. Presumably it would always make the nearest end to a natural target its head.

But as I said, separate concept.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 04-27-2019 06:09 AM]
04-27-2019 at 06:06 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (+1)  
The intended behaviour is indeed that 2-tile snakes are unkillable. This allows for many interesting puzzles. A bit like clearing tarstuff with double stabs to get the right parity etc.

Hydra sounds nice. I thought of worm as well, but that sounds a bit too harmless :)

Anyway, I'll need to do some polishing. Did not yet look at the interactions with architecture. Especially force arrows may be hard to do: moving is ok, but orientation of the segments (especially the cornercorners segments of the snake) is a subtle thing to get to work completely reliable.

____________________________
Autocorrect is not my friend. Apologies for the typos.

[Last edited by Dying Flutchman at 04-27-2019 08:59 AM]
04-27-2019 at 06:35 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 771
Registered: 06-13-2015
IP: Logged
icon Re: A snake (0)  
You could always go back to "Original snake" behavior and make it treat force arrows like walls if they're too much trouble. But I guess you still need it to be able to cope if it steps over a disabled one which is then turned on afterward.

Anyway, "unkillable" but presumably bombs/dropping a bridge out from under it still works, yeah? Just like how you can bomb or bridge-drop the "invincible" head of a rattle/regular snake and it'll die. Actually, one problem I foresee is that even "invincible" scripted characters are killed by briar (see also what happens in BSL). So you might run into trouble there.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 04-27-2019 03:40 PM]
04-27-2019 at 03:37 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (+2)  
Back again.

I've cleaned up the code and it works very well. The snakes sort themselves out nicely, there's no nasty limits on the amount of snakes and they basically behave the way they should.

But killing them. Wow, that's hard!

Method 1 --> use a sword. Easy. Works like a charm.
Method 2 --> contraptions. Easy in theory, very hard in practice.
The problem is that bombs, hot tiles, spikes and firetraps kill NPCs and monsters at the very end of the turn. This means that all NPCs act out their complete turn and only die at the end of that turn.
This causes a big problem, because the snake segments need real-time updates when other segments die, because when a snake splits, body segments become tail or head parts and tail or head parts may die because they become detached from the rest of the snake.

I can solve some of the cases:
a) Firetraps --> when using 'wait for item -> active firetrap', I get a result right away. I can then kill the relevant segment(s) using scripting and take appropriate action.
b) Spikes --> I can detect the event 'spikes poised', which gives me exactly one turn to predict which segments might get killed.
c) Hot tiles --> I can detect presence of a hot tile and 'manually' kill segments at the appropriate time.

Option c is working already. Option a should be easy to build. Option b might be difficult, but I think I'll manage.

There is one case for which I have no solution really: explosions from bombs and kegs. The 'bomb exploded' event triggers at the very end of the turn and that is too late to actually let the NPCs handle any relevant code. As a result, you might for instance blow up the middle part of the snake, and only a turn later the head/tail parts disappear.

Does anyone have experience with this problem? I specifically need a method do detect bomb explosions on specific tiles while NPC scripts are still being executed. Waiting untill the end of the turn is not an option.
Who can help me out?


Regardless of the answer to the explosion detection problem, I will try to implement detection for firetraps and spikes later this week and share a demo hold with you for feedback.

____________________________
Autocorrect is not my friend. Apologies for the typos.
04-30-2019 at 10:34 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
mauvebutterfly
Level: Smiter
Rank Points: 428
Registered: 05-03-2015
IP: Logged
icon Re: A snake (+1)  
Serpent enemies are immune to bombs as long as the head isn't being hit, so maybe you can do something with that?

____________________________
106th Skywatcher
05-01-2019 at 06:17 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (0)  
quote:
mauvebutterfly wrote:
Serpent enemies are immune to bombs as long as the head isn't being hit, so maybe you can do something with that?


Yes, you're right of course. Didn't even think of that. Don't know if I'll be able to sort out the head problem. For the body, I'd need to use a base monster that's immune to bombs. Is there a monster that does that? Gentryii are not available for scripting, but fevundos perhaps? I'll see what I can do.

Thnx

____________________________
Autocorrect is not my friend. Apologies for the typos.
05-01-2019 at 07:23 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged

File: 2019 05 05 - Hydra testing.hold (9.8 KB)
Downloaded 3 times.
License: Public Domain
icon Re: A snake (+2)  
I'm getting somewhere. Attached to this post is a demo-room with Hydra in it.

Please feel free to play around with it and test the behaviour if you're bored.

Go and break it if you can! That's the type of feedback I need from you :)

A couple of remarks:
1 Behaviour is pretty much as I like it, however, it's not possible to get the Hydra to do exactly as I want. The remaining stuff is bugging me, but considering what I managed to make the hydra do, I can live with the things it doesn't.
1a Briar is done at the end of the turn, so updating the graphics to incorporate briar interaction is fundamentally broken (I believe it's impossible to repair).
1b Similarly: releasing buttons to turn off fire traps will not work. The Hydra will burn on a fire trap, even it has just been switched off by depressing a plate. Normal snakes would not be burned.
1c Speed potions have no effect on the hydra. Seems to be difficult to change.
1d Stealth is not yet implemented, but that seems to be relatively easy, so I'll try to do that at some later time.
2 Graphics are temporary. Need to start on that now. Actually, I would like to use the existing snakes as a basis for the design. Anyone know whom I should ask about this for permission?
3 Hydra: it's a cool name, but I believe Xindaris coined this for one of his projects. Can I use that name?
4 Movement: I've chosen for simple movement: the head moves towards Beethro. When tied, preference is N,S,W,E. So vertical first, NW over SE preference. Wait is only used when no other move is possible.
Also: because the body segments get in the way, the hydra is surprisingly 'intelligent' when persuing Beethro.
5 I'm still struggling with getting the Hydra to act as 'required target'. I know that I need other monsters in the room for it to work, but still no luck. Anyone having experience with that?

This is getting quite a big project ;) Would be very happy with your feedback.

____________________________
Autocorrect is not my friend. Apologies for the typos.
05-05-2019 at 08:53 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 771
Registered: 06-13-2015
IP: Logged
icon Re: A snake (+1)  
As the name goes, I don't care if you use it. For one thing it's fine if there's more than one custom doodad with the same name, for another it's almost guaranteed that I wasn't going to ever build a working "hydra" myself.

For graphics permission, you could ask mrimer, since he's been active on the forum lately. I forget who else can give permission though.

Haste requires you to have a variable for tracking whether or not that state has been toggled (which separate characters "watching" every potion in the room update), and then try to make the snake "wait a turn" whenever it's presently the "half turn". Pretty sure the first half-turn is the turn immediately after the player takes the potion. Stealth needs something similar unless you're already using get natural target, which accounts for stealth already. HOWEVER, you should make sure that your monster behaves correctly in the situation where there is no natural target available (as would happen if Beethro was in shallow water too far away to be "seen")--I'm pretty sure "get natural target" returns the entity's own coordinates in that situation.

Required target is an imperative that clashes with certain other imperatives such as invulnerable. I'm not sure which way you mean it to not be working, though. The traditional way to make a required custom monster be the "only" monster in a room is to put a normal monster (roach, evil eye, whatever) somewhere in the room along with a character that instantly attack tile kills that monster's location. Meanwhile the custom monster should begin its script with "If... wait for clean room... goto [do nothing label at end of script]... else... appear... goto [do stuff part of script]" (and start out with the visibility checkbox NOT ticked).



____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 05-05-2019 08:27 PM]
05-05-2019 at 08:24 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (+1)  
Hi Xindaris,

Thanks for your response.

quote:
Xindaris wrote:
Haste requires you to have a variable for tracking whether or not that state has been toggled (which separate characters "watching" every potion in the room update)...



I am aware that it's possible to monitor the room for potions and take appropriate action. However, I have now managed to pack the complete hydra code into the hydra NPCs themselves (BTW tnx for granting me official 'naming permission' on behalf of the naming committee presided by you).

I would very much like to keep it that way. If correct behaviour depends on introducing extra NPCs, I'd rather not do it. So for now, I'm inclined to not implement this. But this may change...

quote:
Xindaris wrote:
...using get natural target, which accounts for stealth already. HOWEVER, you should make sure that your monster behaves correctly in the situation where there is no natural target available...



I am actually not using get natural target. May be an interesting improvement. I've never tried to work with that command, but it might enable me to streamline my code a bit. Especially, I would assume this works with decoys [assuming the 'base monster' for the NPC is attracted by them]? Anyway, will play around with that.

quote:
Xindaris wrote:
Required target is an imperative that clashes with certain other imperatives such as invulnerable...
(and start out with the visibility checkbox NOT ticked)


Pretty sure those issues need to be checked. Tnx.


____________________________
Autocorrect is not my friend. Apologies for the typos.

[Last edited by Dying Flutchman at 05-05-2019 08:42 PM]
05-05-2019 at 08:37 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Someone Else
Level: Smitemaster
Avatar
Rank Points: 1174
Registered: 06-14-2005
IP: Logged
icon Re: A snake (+1)  
I have detected a bug! If you stab a 2-long hydra in the tail while you have a speed potion, the tail is replaced by a hydra head of doom that can move in any direction and can only be killed by dropping in water or in a pit.

This is clearly a critical bug.

Otherwise, really neat!
05-05-2019 at 08:51 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 771
Registered: 06-13-2015
IP: Logged
icon Re: A snake (+2)  
Natural target returns the location of what any default monster would consider its "target" based on the calling character's location. I.e.,
-If Beethro is invisible/in water and not in "smell range", it does not give Beethro's location; if he is in smell range then it includes him in consideration
-If there are timeclones, it returns the correct "nearest" one
-If there are decoys/stalwarts/soldiers it returns the nearest one in smell range or whatever the rules usually are.

Basically it accounts for stealth, decoys, everything, all in one neat little commend. It was a wonderful addition to scripting.

Also, it's really not that bad to need a couple of ancillary characters to keep track of certain room states. Flowers, for example, need somebody to tell them whether there's a brain in the room or not.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 05-05-2019 08:58 PM]
05-05-2019 at 08:56 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged

File: 2019 05 05 - Hydra testing.hold (11.8 KB)
Downloaded 1 times.
License: Public Domain
icon Re: A snake (+2)  
Quick update:

I have added 'get natural target' and now invisibility works correctly (both the potion and shallow water version). Also: decoys decoy (is that a verb :) )

There are still problems with some things updating at the end of the turn and giving bad graphics:
* Bombs/kegs through fuses (it does work when stabbing them)
* Stabbing the hydra directly when placing a decoy/clone/mimic
* Briar killing hydra segments
* Stepping OFF plates to ignite fire traps
There's not really a way of checking for things that happen after the NPCs did their job. So I guess care should be taken not to allow these things to happen.

I'm happy with the improved invisibility and decoy behaviour!

Not happy with required target behaviour :(
I have set the NPCs to 'required target', NOT to 'invulnarable' at the start of the script, although the head and tail segments do become invulnerable later on.
I also placed a conquer token in the room (also tried with an extra roach in the room).
When playing, the room turnes green as soon as I destroy all regular monsters and step on the token. Hydra seem to be completely ignored.
Hiding the hydra at the start of the script is not an option, since the hydra segments must look around for trailing segments when initializing to identify which snake they belong to. However, I guess that's not essential for making 'required target' work. (I did try to make them invisible when starting out though, did make a mess of the script, but did not solve the required target problem). Guess I have to dive into it deeply some time.

Update attached to this post.

____________________________
Autocorrect is not my friend. Apologies for the typos.
05-05-2019 at 09:20 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (0)  
quote:
Someone Else wrote:
I have detected a bug! If you stab a 2-long hydra in the tail while you have a speed potion, the tail is replaced by a hydra head of doom that can move in any direction and can only be killed by dropping in water or in a pit.

This is clearly a critical bug.

Otherwise, really neat!


Some quick responders we have here on the forum :) Missed your input when composing my previous post...

This is indeed critical. But fortunately, I have decided to ignore anything that has anything to do with speed potions for now.

What problem were you talking about? :glasses

____________________________
Autocorrect is not my friend. Apologies for the typos.
05-05-2019 at 09:22 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 771
Registered: 06-13-2015
IP: Logged
icon Re: A snake (+1)  
To be perfectly clear:
-If an NPC has "Appeared" and has "required target" set to "yes", then the room is not clear unless it was cleared previously to that happening.
-HOWEVER, if a "Required target" runs "imperative invulnerable" then it immediately stops being a required target.
-A room that is not yet clear changes to the "cleared" (i.e., green on the map) status as soon as any conquer tokens present have been activated and there are no required targets left in the room.

Given that, I'm guessing your problem has something to do with at least one turn or partial turn during which every living snake part is invulnerable and/or not considered a required target.

Also, NPCs are perfectly capable of detecting other NPCs regardless of whether they're invisible or not. You should easily be able to run the "setup step" with invisible snake parts as long as they're in the correct locations/orientations (assuming that applies) beforehand. If you don't have your snake parts default to invisible when the room starts then they're going to be there every time the player enters the room, whether they already cleared it or not, which is kind of a problem. But I guess maybe you could have snakeparts attack tile kill their own location via myscript if the room's already pre-cleared?

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 05-06-2019 01:05 AM]
05-06-2019 at 01:04 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 217
Registered: 01-27-2017
IP: Logged
icon Re: A snake (+1)  
There we go.

I've implemented all that could/should realistically be implemented. Some interactions will never work, due to the processing order of Certain Things. I can live with that.

Attached the 'definitive' :closedeyes Hydra demonstration.

So now it's
***Building time***
Perhaps I am being outrageously confident, but I could imagine that some of you may be curious to use the Hydra in one or several puzzles.

So perhaps it would be a good idea to explore the possibilities together? I could imagine to build an easy introduction level with a bit of background story, and then add your input as separate levels into a single 'hub-style' hold layout. Would love to see what you would do with the Hydra.

I intend to start an architecture thread about this pretty soon. So if you would like to join, just send me a PM. Any input is welcome.

Edit: demonstration hold added to first post.

____________________________
Autocorrect is not my friend. Apologies for the typos.

[Last edited by Dying Flutchman at 05-07-2019 10:02 PM]
05-06-2019 at 10:03 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Architecture : A snake (I scripted one)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.