Tutorial and fastplay conversion

For AI and campaign script related discussions and questions

Tutorial and fastplay conversion

Postby Berserk Cyborg » 28 Nov 2017, 21:50

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
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 335
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Postby NoQ » 29 Nov 2017, 01:52

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.
User avatar
NoQ
Special
Special
 
Posts: 6097
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Tutorial and fastplay conversion

Postby Per » 29 Nov 2017, 02:51

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3647
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Postby Berserk Cyborg » 29 Nov 2017, 06:35

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.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 335
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Postby Per » 29 Nov 2017, 10:43

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3647
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Postby Berserk Cyborg » 29 Nov 2017, 16:01

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.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 335
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Postby Per » 29 Nov 2017, 22:57

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/commit/ff4e77794dcbba32ca1ac0779aadbb256a3109bf
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3647
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Postby Berserk Cyborg » 01 Dec 2017, 05:26

Per wrote:Parts of it pushed.

Causes a crash when loading saves. See http://forums.wz2100.net/viewtopic.php?f=1&p=139167#p139166.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 335
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Postby Lord_Kane » 01 Dec 2017, 05:31

Berserk Cyborg wrote:
Per wrote:Parts of it pushed.

Causes a crash when loading saves. See http://forums.wz2100.net/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 3 times
User avatar
Lord_Kane
Trained
Trained
 
Posts: 63
Joined: 24 Nov 2016, 21:51

Re: Tutorial and fastplay conversion

Postby Per » 02 Dec 2017, 20:22

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()
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3647
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Postby Berserk Cyborg » 02 Dec 2017, 20:50

Awesome! Updated the list again.

Per wrote:hackPlayIngameAudio()
hackStopIngameAudio()
Looks like you got a copy paste oddity with the debug messages in those two.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 335
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Postby Per » 02 Dec 2017, 21:59

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: 3647
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Postby Per » 02 Dec 2017, 23:04

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!
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3647
Joined: 03 Aug 2006, 19:39

Re: Tutorial and fastplay conversion

Postby Berserk Cyborg » 02 Dec 2017, 23:39

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
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 335
Joined: 26 Sep 2016, 19:56

Re: Tutorial and fastplay conversion

Postby Berg » 03 Dec 2017, 00:18

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.
User avatar
Berg
Regular
Regular
 
Posts: 1881
Joined: 02 Sep 2007, 23:25
Location: Australia

Next

Return to Scripting