Page 1 of 1

More methods to interact with tutorials

Posted: Tue Nov 07, 2017 9:03 pm
by Bilka
I would be nice if the following things were added:

Tutorials can be unlocked by script (and maybe also locked again) instead of just by placing entities/researching something/crafting something.

Hidden property for the prototype. Would be nice if that were writable + readable runtime, but it doesn't have to be.

game(player?).start_tutorial("tutorial-name", ignore-locked-status): Drops the player into the tutorial as if the player clicked on the "start tutorial" button in the gui. Second param is an optional boolean that can be set to true to ignore the fact that the tutorial is locked, otherwise when the tutorial is still locked, start_tutorial won't do anything (except return false or something like that).


Some questions about the current tutorial implementation: Does the main map get paused when a player enters a tutorial? What happens in multiplayer? Are remote functions from mod accessible within tutorials? If not, it would be nice if that were possible.

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 9:10 pm
by Rseding91
I can add a method to LuaGameScript that will put a player in a tutorial but it's only going to do anything in single player.

Tutorials don't work in multiplayer - they're disabled. In single player the map is paused and the tutorial runs. In 0.15 mods run as normal in the tutorial but in 0.16 they will be disabled scripting wise.

Tutorials aren't part of the game state and as such mods can't have access to anything about them being run/unlocked.

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 9:23 pm
by Bilka
Rseding91 wrote:Tutorials aren't part of the game state and as such mods can't have access to anything about them being run/unlocked.
Does this mean the tutorial has to always run the same way (be sandboxed entirely)? Or could there be the one way street of being able to read something from within the tutorial?

For the unlocking thing: Can't I just simulate that by creating a hidden tech that I research using script to unlock the tutorial? If that is possible, what would be the problem with doing it directly from script?

Also, what about
Bilka wrote:Hidden property for the prototype. Would be nice if that were writable + readable runtime, but it doesn't have to be.
?

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 9:35 pm
by Klonan
I feel like you're trying to do something with tutorials, what they were never intended to do

If you want to teleport them to some magic surface for them to build blueprints or something, then you should do it with the standard script interface

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 9:44 pm
by Bilka
Klonan wrote:I feel like you're trying to do something with tutorials, what they were never intended to do

If you want to teleport them to some magic surface for them to build blueprints or something, then you should do it with the standard script interface
That:
  • Doesn't pause the main game (HUGE concern)
  • Allows saving while on the surface, contrary to tutorials (Big concern)
  • Can't use a blueprint.dat (Slightly smaller concern but still very inconvenient)
Speaking of that... I can't find out if a player completed a tutorial, can I? And that's also not part of the game state if I'm gauging this correctly?

I basically want to make puzzles that the player can get teleported into and then completes and the player gets teleported out and I know that the player went through the puzzle. The three points I listed are the reasons why I am looking into using tutorials instead of surfaces.

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 10:51 pm
by Rseding91
You won't be able to use tutorials for what you're trying to use them for. You can't transfer anything between a tutorial and a normal game and in fact in 0.16 mods just won't run in tutorials at all.

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 10:56 pm
by Bilka
Oh well.

Re: More methods to interact with tutorials

Posted: Tue Nov 07, 2017 11:51 pm
by eradicator
Rseding91 wrote:You won't be able to use tutorials for what you're trying to use them for. You can't transfer anything between a tutorial and a normal game and in fact in 0.16 mods just won't run in tutorials at all.
Haven't looked at tutorials much yet...but i guess this implies that modders can't make custom tutorials for their mods either?

Re: More methods to interact with tutorials

Posted: Wed Nov 08, 2017 12:41 am
by Rseding91
eradicator wrote:
Rseding91 wrote:You won't be able to use tutorials for what you're trying to use them for. You can't transfer anything between a tutorial and a normal game and in fact in 0.16 mods just won't run in tutorials at all.
Haven't looked at tutorials much yet...but i guess this implies that modders can't make custom tutorials for their mods either?
I believe you can, just not using control.lua in a standard mod. They're done as scenarios.

Re: More methods to interact with tutorials

Posted: Wed Nov 08, 2017 2:26 am
by eradicator
Rseding91 wrote:
eradicator wrote:
Rseding91 wrote:You won't be able to use tutorials for what you're trying to use them for. You can't transfer anything between a tutorial and a normal game and in fact in 0.16 mods just won't run in tutorials at all.
Haven't looked at tutorials much yet...but i guess this implies that modders can't make custom tutorials for their mods either?
I believe you can, just not using control.lua in a standard mod. They're done as scenarios.
That sounds like i'd have to port all of the logic (event-handlers etc) from control.lua into the scenario? Which is pretty unfeasible as soon as a mod depends on other mods to also be present and working correctly. Well. I wasn't planning to do tutorials any time soon, and this sounds like i'm not going to either. Thanks for the answer though. 8-)

/me stops derailing the topic

Re: More methods to interact with tutorials

Posted: Wed Nov 08, 2017 11:14 am
by Klonan
At some point we might add better support for mod tutorials, but for now the goal is to make the tutorials work properly in the base game

Allowing any random installed mod script to run sometimes breaks the tutorials, and we were receiving bug reports about it,
We might allow mod scripts for a mod which adds a tutorial, IE if upgrade planner adds a tutorial, it will also allow the upgrade planner control.lua (and maybe any dependencies)...