Author Topic: Endless docking loop of doom!  (Read 4415 times)

0 Members and 1 Guest are viewing this topic.

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Endless docking loop of doom!
Obviously my mind has reached it's limits, and thus I turn to ask for help from the greater wizards.
So... any of you guys knows how to make this work?.

It's supposed to be an endless docking loop between 3 ships, check attached mission for details.

[attachment deleted by an evil time traveler]
el hombre vicio...

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Endless docking loop of doom!
This is tricky.  I'm fairly sure I know what's going on, but fixing it will involve deeper thinking.

Take a look at this sexp...
Code: [Select]
   ( and
      ( has-docked-delay
         "A"
         "B"
         @dockCount[1]
         5
      )
      ( = @r1True[1] 1 )
   )

Do not assume that and requires its conditions to be true simultaneously.  I suspect what happens is that the has-docked-delay portion becomes true all over again after the trigger delay elapses.  Thereafter, it only waits on the r1True portion, which itself becomes true as soon as the transport docks with the second ship.

I think you're going to have to come up with some kind of state machine.  Make a series of sexps, each testing only one condition on a trigger loop and storing the result in a variable: docked with A, undocked with A, docked with C, undocked with C.  Then make another series of sexps that issue orders to ship A depending on what the variable values are.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Endless docking loop of doom!
It is indeed that. Has-docked-delay returns SEXP_KNOWN_TRUE. This is actually one of the few cases when you should be using every-time rather than when.

Obviously my mind has reached it's limits, and thus I turn to ask for help from the greater wizards.

I notice you don't have any event.log flags set. If you'd used those, it would have shown you the issue immediately (Whether you actually had the FRED knowledge required to interpret it, is another issue though).
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: Endless docking loop of doom!
Yeah I suspected about the docked-delay being the culprit.
Ok, I'll have a go at your suggestions. Thanks!
el hombre vicio...

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Endless docking loop of doom!
It is indeed that. Has-docked-delay returns SEXP_KNOWN_TRUE.

It's not only that, it's the fact that has-docked-delay checks the mission log.  So it's possible for it to become true even if the ship isn't actually docked at the time the sexp fires.

I suppose it wouldn't be a bad idea to add is-docked, in the same way that we have is-tagged.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Endless docking loop of doom!
It's not only that, it's the fact that has-docked-delay checks the mission log.  So it's possible for it to become true even if the ship isn't actually docked at the time the sexp fires.


Well you can get around that one with a use of has-undocked-delay. I'll agree that it's much more cumbersome than an is-docked SEXP would be but it should work.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline 666maslo666

  • 28
  • Artificial Neural Network
Re: Endless docking loop of doom!
I suppose it wouldn't be a bad idea to add is-docked, in the same way that we have is-tagged.

Please do, I made such feature request a year ago:

http://www.hard-light.net/forums/index.php?topic=84072.msg1679278
"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return." - Leonardo da Vinci

Arguing on the internet is like running in the Special Olympics. Even if you win you are still retarded.

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: Endless docking loop of doom!
Well after a few tries, I'm inclined to believe this is impossible to achieve right now.

Bottom line seems to be that if I cannot check exactly the moment when given ship is docked with another one (to control when to issue orders) this cannot be achieved.

State machine works, but only for the first iteration. On the second run it will not perform due to all steps being already true, thus making impossible to issue orders with appropriate timing.

I tried a lot of different approaches, and I'm fairly sure some will perform better than others but if someone wants to use my tries here I attach the mission for you guys to play with it.

[attachment deleted by an evil time traveler]
el hombre vicio...

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Endless docking loop of doom!
To be honest, I can't make head nor tails of what you're trying to do in your test mission. Having poorly labelled variables and events just makes things very confusing for someone else.

But you still seem to be using when in the first 4 events and that definitely won't work for the reasons above.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline 666maslo666

  • 28
  • Artificial Neural Network
Re: Endless docking loop of doom!
Well after a few tries, I'm inclined to believe this is impossible to achieve right now.

Bottom line seems to be that if I cannot check exactly the moment when given ship is docked with another one (to control when to issue orders) this cannot be achieved.

State machine works, but only for the first iteration. On the second run it will not perform due to all steps being already true, thus making impossible to issue orders with appropriate timing.

I tried a lot of different approaches, and I'm fairly sure some will perform better than others but if someone wants to use my tries here I attach the mission for you guys to play with it.

I too am not sure what exactly you want to do. But maybe you can use separate has-docked-delay events for more iterations. For second iteration, set "The number of times they have to have docked" to 2 etc. Thats what I do in my mod and it works essentialy as is-docked would, and works for repeated and daisy chained dockings, too. It wont be an endless loop, tough.
"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return." - Leonardo da Vinci

Arguing on the internet is like running in the Special Olympics. Even if you win you are still retarded.

 

Offline 666maslo666

  • 28
  • Artificial Neural Network
Re: Endless docking loop of doom!
Here is simple mission with endless loop of docking and undocking, maybe it will help you.

[attachment deleted by an evil time traveler]
"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return." - Leonardo da Vinci

Arguing on the internet is like running in the Special Olympics. Even if you win you are still retarded.

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: Endless docking loop of doom!
Mmm, yeah I get what you say. That mission is the result of multiple test iterations, so it's bound to be somewhat confusing.
After a few attempts I just lost the will to keep the code neat.

I'm missing your point on the use of when on the first 4 sexps, IIRC those where the sexps that issue the orders to the transport. I cannot use an every-time there, the transport will just stop responding if I spam it with orders endlessly.


About the concept of the mission itself:

3 ships.
2 of them staying still.
1 of them switching to dock on the first on one, then undocking and moving to dock on the second one. Repeat last step in an endless loop.

Thanks maslo, I don't have fred right here, but from what I could understand checking the mission on notepad your example will not work for what I want to achieve. It's just docking endlessly with a single ship, I want to use both.
el hombre vicio...

 

Offline 666maslo666

  • 28
  • Artificial Neural Network
Re: Endless docking loop of doom!
About the concept of the mission itself:

3 ships.
2 of them staying still.
1 of them switching to dock on the first on one, then undocking and moving to dock on the second one. Repeat last step in an endless loop.

Thanks maslo, I don't have fred right here, but from what I could understand checking the mission on notepad your example will not work for what I want to achieve. It's just docking endlessly with a single ship, I want to use both.

OK, try this, two stationary ships and one Elysium going endlesly between them.

[attachment deleted by an evil time traveler]
"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return." - Leonardo da Vinci

Arguing on the internet is like running in the Special Olympics. Even if you win you are still retarded.

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: Endless docking loop of doom!
Ohhh it works like charm, and it bugs me because I've already tried that and things didn't work out!
But never fear, I see where I ****ed it.

Thanks for the help guys, and sorry you had to put up with my dumbness  ;)
el hombre vicio...

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Endless docking loop of doom!
OK, try this, two stationary ships and one Elysium going endlesly between them.

Yep, that's pretty much what I was trying to point out.

This sort of issue is the real reason for the existence of the every-time operators. Otherwise you might as well just use repeated when with a delay of 0. It is actually less CPU intensive to do so.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]