Tutorial and fastplay conversion

For AI and campaign script related discussions and questions
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Tutorial and fastplay conversion

Post by Berserk Cyborg »

I took the liberty of converting the fastplay demo into a JS script. Essentially I treated it as a campaign mission and everything is controlled by the campaign library. Like the cam3-4 mission, the gameOverMessage function will probably need to be changed a bit. But other than that not much else to say since it is a pretty bare bones map.

Was going to do the tutorial, but it looks kind of scary and I am not even sure if it is possible with the current JS API.

current work.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Tutorial and fastplay conversion

Post by NoQ »

Cool!

We've once been thinking if those should be challenges rather than campaigns. It turned out to be complicated because they need to use campaign stats (eg. tech tree), while challenges usually use multiplayer stats.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Post by Per »

Cool, indeed!

Could you start making a list of things that are missing in the JS API for the tutorial? Should be easy to fix.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Post by Berserk Cyborg »

I think these are what needs to be added. I will try listing the functions I see in the WZScripts:

1. removeReticuleButton(button_id)
2. Set the inTutorial flag (bInTutorial?)
3. stopCDAudio() / playIngameCDAudio()
4. addConsoleText()
5. tagConsoleText()
6. toggle flash of a reticule button. flashOn(button_id) / flashOff(button_id)
7. clearConsole()
8. event for when a certain reticule button is pressed
9. event for moving a factory delivery point
10. droid selected event
11. event when a menu icon is selected (think research item / build menu structure)
12. event when a droid design menu icon is selected (ie. vehicle/propulsion/weapon icon)

some others that I saw but probably not needed:
1. tutorialTemplates()
2. setCampaignNumber()
3. set gameLevel
4. setRadarZoom()
5. pause()
Last edited by Berserk Cyborg on 02 Dec 2017, 23:34, edited 4 times in total.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Post by Per »

I already have a patch for 1, 11, and 12 in the works, just need to get time to finish it.

I would like to make the inTutorial flag obsolete.

console() isn't enough to replace addConsoleText()?

For 10, we have eventSelectionChanged().

Not sure what some of the others do, I'll have to look into it.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Post by Berserk Cyborg »

Per wrote: console() isn't enough to replace addConsoleText()?

For 10, we have eventSelectionChanged().
Did not know about those... will update the list. Yeah, they both look like what was needed then.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Post by Per »

Per wrote:I already have a patch for 1, 11, and 12 in the works, just need to get time to finish it.
Parts of it pushed. Preview of unfinished remainder: https://github.com/perim/warzone2100/co ... 256a3109bf
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Post by Berserk Cyborg »

Per wrote:Parts of it pushed.
Causes a crash when loading saves. See viewtopic.php?f=1&p=139167#p139166.
User avatar
Lord_Kane
Trained
Trained
Posts: 104
Joined: 24 Nov 2016, 21:51

Re: Tutorial and fastplay conversion

Post by Lord_Kane »

Berserk Cyborg wrote:
Per wrote:Parts of it pushed.
Causes a crash when loading saves. See viewtopic.php?f=1&p=139167#p139166.
check my investigation results in that thread, logs are there in a 7z file but for convenience I have slapped them here too.
Attachments
logs.7z
(2.76 KiB) Downloaded 200 times
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Post by Per »

Berserk Cyborg wrote: 3. stopCDAudio() / playIngameCDAudio()
7. clearConsole()
9. event for moving a factory delivery point
Implemented in e26b9516d3e065527e41fe5006f9f94983653882, which adds:
clearConsole()
hackPlayIngameAudio()
hackStopIngameAudio()
eventDeliveryPointMoving()
eventDeliveryPointMoved()
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Post by Berserk Cyborg »

Awesome! Updated the list again.
Per wrote: hackPlayIngameAudio()
hackStopIngameAudio()
Looks like you got a copy paste oddity with the debug messages in those two.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Post by Per »

Berserk Cyborg wrote:Looks like you got a copy paste oddity with the debug messages in those two.
:oops: 1a45f2778137e757f14b295101b195a6f732c3d0
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Post by Per »

Berserk Cyborg wrote:I think these are what needs to be added. I will try listing the functions I see in the WZScripts:
1. removeReticuleButton(button_id)
2. Set the inTutorial flag (bInTutorial?)
3. stopCDAudio() / playIngameCDAudio()
4. addConsoleText()
5. tagConsoleText()
6. toggle flash of a reticule button. flashOn(button_id) / flashOff(button_id)
7. clearConsole()
8. event for when a certain reticule button is pressed
9. event for moving a factory delivery point
10. droid selected event
11. event when a menu icon is selected (think research item / build menu structure)
12. event when a droid design menu icon is selected (ie. vehicle/propulsion/weapon icon)
Added in 2810c730e1733262b3ff27decfbb93c1db821a6a (and earlier): 1, 6, 8
Added in 629d43771b4ab621fcedb8403165f7557b235bdf: 11, 12 (I think all covered now?)

If 5 is really needed, I think it should handled by an extra, optional parameter to console(). Let me know if this is needed, and what other things this should do.

Number 2 is already handled by setTutorialMode(true);

If tutorial is converted as well, then the move away from the old wzscript would be almost complete, which would be a momentous achievement!
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Post by Berserk Cyborg »

Per wrote: If tutorial is converted as well, then the move away from the old wzscript would be almost complete, which would be a momentous achievement!
Yeah, there are still those weather and fog scripts still being used for multiplay/campaign in the base/script/text directory. I know the weather stuff can be ported over, not sure if the fog functions are useful anymore. They also use the setCampaignNumber().

I guess after that only tech level research enablers for skirmishes are left and Nexus AI.
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

Re: Tutorial and fastplay conversion

Post by Berg »

On a side note still within topic can a tutorial be added to show new player about unit orders if its not already in the tutorial.
I think this will rectify other issues for newbies that don’t know about orders and remove the idea that new folks cant find units orders.
Post Reply