The official --=jscam=-- thread

For AI and campaign script related discussions and questions
User avatar
Iluvalar
Regular
Regular
Posts: 1782
Joined: 02 Oct 2010, 18:44

Re: The official --=jscam=-- thread

Post by Iluvalar » 28 Oct 2014, 19:07

I had to fix that when I was adding the passability on new propulsion support to the 2.3 source code. I found that the map was loading the pathfinding for no good reason. Only because it run another function which load it for other purpose... I had to place a switch on that function to NOT load the path finding when not needed (aka draw the map)
Heretic 2.3 improver and proud of it.

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3753
Joined: 03 Aug 2006, 19:39

Re: The official --=jscam=-- thread

Post by Per » 29 Oct 2014, 09:40

vexed wrote:I did have fastplay converted 1:1 to JS, along with all required functions need to make it work, back when I was evaluating how feasible JS is. Sent Per a copy as well as some stuff I found out about how all this works.
I have attached a copy. It is using a very different API than we have now, though, so I actually think it would be less work to start again from scratch.
Attachments
0001-Fastplay-testing-for-js-conversion.patch
Old patch
(76.72 KiB) Downloaded 165 times

User avatar
vexed
Inactive
Inactive
Posts: 2471
Joined: 27 Jul 2010, 02:07

Re: The official --=jscam=-- thread

Post by vexed » 30 Oct 2014, 03:56

Wow... time sure does fly by!

And yeah, that was a quick & dirty conversion of everything in fastplay. There was no attempt to fix anything, just a straight 1:1 port.
/facepalm ...Grinch stole Warzone🙈🙉🙊 contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 31 Oct 2014, 08:11

Yay, i see, at least i wouldn't miss the tiny 'start' script of the fastplay.

P.S. I'd have double weekend this time.
Spoiler:
Goth Zagog-Thou: if you're still struggling with the transport, let me know. If you're already past it, let me know anyway (: Right now we're not quite having saved games working, so it gets difficult to debug later levels, so it's not fun to skip yet, so i'd rather focus on helping with the transport mission (i do have my tutorial work as a "plan B" anyway though).

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 01 Nov 2014, 08:38

NoQ wrote:i do have my tutorial work as a "plan B" anyway though
Emm no i don't.

Houston: Per: if i convert fastplay or tutorial into a challenge, i need to find out how to load the campaign research tree rather than the multiplayer research tree. For instance, researching mg in tutorial shouldn't unlock the mg bullets upgrade, and engineering research in fastplay shouldn't unlock the engine upgrade.

Since the tree is very small in both cases, i don't mind modifying-stats-from-scripts instead, as soon as it's possible (: But right now i cannot avoid having the mp tech tree applied, can i?

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 01 Nov 2014, 12:29

Having a look at launching the transport, on cam1-2s as an example. I think we don't yet have a script function that would load the away mission when the transport leaves, and i think we don't even have events to notice transporter leaving; the only eventTransporter* i've seen triggered was eventTransporterLaunch, which is too early.

Also, i have an unrelated question regarding POTFILES.in. Commit 5543c6a removes a script from this file, so that the game no longer looked for translatable strings in it. But there never were any translatable strings in this file ... right? They only contain references to strings.txt and similar stats, and even those are in vlo files, not in slo files. Why are all these files mentioned in POTFILES.in anyway? :hmm:

P.S. Since e43e57b, it's possible to see debug prints in eventStartLevel, as long as cheats were enabled on the previous level.

EDIT. hmm, loadLevel() seems to work.

cybersphinx
Inactive
Inactive
Posts: 1689
Joined: 01 Sep 2006, 19:17

Re: The official --=jscam=-- thread

Post by cybersphinx » 01 Nov 2014, 15:01

NoQ wrote:Also, i have an unrelated question regarding POTFILES.in. Commit 5543c6a removes a script from this file, so that the game no longer looked for translatable strings in it. But there never were any translatable strings in this file ... right? They only contain references to strings.txt and similar stats, and even those are in vlo files, not in slo files. Why are all these files mentioned in POTFILES.in anyway? :hmm:
There is a script po/update-po.sh (not to be confused with make -Cpo update-po) that generates POTFILES.in.
We want information... information... information.

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 01 Nov 2014, 15:40

Yay, got the preparation for an off-world mission working. The scenario is as ridiculously short as it should be - around 10 lines of code (efc04bd). Had to fix a transporter exit event (cf6a369).

That's done without labels. Do we really need labels? Everything looks so nice without them.
cybersphinx wrote:a script po/update-po.sh
Yay, it works. The question remains though - the script doesn't look for actual translatable strings, it only looks for file extensions that may contain them (or may not). Which is not very important, i guess.

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3753
Joined: 03 Aug 2006, 19:39

Re: The official --=jscam=-- thread

Post by Per » 02 Nov 2014, 00:22

NoQ wrote:if i convert fastplay or tutorial into a challenge, i need to find out how to load the campaign research tree rather than the multiplayer research tree.
I don't understand the problem(s). The wrf files for fastplay and tutorial should load the correct research trees, and the qtscript code set up everything to match. Doesn't this happen already?

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 02 Nov 2014, 06:56

Now it does. If i convert them to javascript now, there's no problem. But if i'm to convert them into a challenge, it no longer would (and no WRF files would remain, and even if they are here, mp.wz would still be loaded first).

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 02 Nov 2014, 19:31

9583cb6: Mostly sorted things out! The level (SUB_1_2) still needs more polishing, but at least the transporter works, "return to lz" works, "lz compromised" works, "reinforcements landing" works.

I'm seeing a magic constant in the c++ side, called LZ_COMPROMISED_TIME, that is used by WZScript's setReinforcementTime() to indicate that LZ is compromised (and, by the way, it cannot be set from JavaScript, because it's not an integer in seconds) but everything seems to work fine when reinforcement time is set to -1 instead.

One fancy item to check out: the "ascend" cheat to go straight to the level by level name, eg.

Code: Select all

ascend sub-1-2s
to instantly try out the newly committed mission. Auto-capitalizes and replaces "-" with "_" to save shift presses, because i'm using it really often, more often than "let me win". Note that it doesn't unlock techs from the skipped levels, so it's a very dirty debugging trick, use at your own risk!

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3753
Joined: 03 Aug 2006, 19:39

Re: The official --=jscam=-- thread

Post by Per » 02 Nov 2014, 23:38

You should be able to set LZ_COMPROMISED_TIME by giving setReinforcementTime() a value of 999999 (defined as SCR_LZ_COMPROMISED_TIME in C++). This value should obviously have been defined as a constant in qtscriptfuncs.cpp already. Feel free to fix :)

User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: The official --=jscam=-- thread

Post by Goth Zagog-Thou » 03 Nov 2014, 00:32

Go ahead and take over Mission 3 in my stead, NoQ. You're moving along at a far better pace than I am. :(

User avatar
vexed
Inactive
Inactive
Posts: 2471
Joined: 27 Jul 2010, 02:07

Re: The official --=jscam=-- thread

Post by vexed » 03 Nov 2014, 03:52

NoQ wrote: Also, i have an unrelated question regarding POTFILES.in. Commit 5543c6a removes a script from this file, so that the game no longer looked for translatable strings in it. But there never were any translatable strings in this file ... right? They only contain references to strings.txt and similar stats, and even those are in vlo files, not in slo files. Why are all these files mentioned in POTFILES.in anyway? :hmm:
The script doesn't check, you are right.
Those files should never be in the POTFILES.in, since.. they aren't used.
So, someone needs to fix the script to be smarter.
NoQ wrote:Now it does. If i convert them to javascript now, there's no problem. But if i'm to convert them into a challenge, it no longer would (and no WRF files would remain, and even if they are here, mp.wz would still be loaded first).
I think this is the wrong approach for them, both the tutorial & fastplay aren't challenges.
They are more like stand-alone missions.
If we rename challenges to something else, then use that screen to load up different items (the tool tips would explain what each "thing" does), we could then use the ini to tell WZ what to load, either mp or base.

Oh, and while looking at why some things don't work anymore, I noticed this comment:

Code: Select all

////////////////////////////////////////////////////////////////////////////////

	yeah, like that. Also, it's exactly 80 characters wide. Code shouldn't be
	wider than that.
Why the 80 char limit ?

Code: Select all

	__camGenericDebug("TRACE",
	                  arguments.callee.caller.name,
	                  arguments);
vs

Code: Select all

	__camGenericDebug("TRACE", arguments.callee.caller.name, arguments);
:hmm:
/facepalm ...Grinch stole Warzone🙈🙉🙊 contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.

User avatar
NoQ
Special
Special
Posts: 6194
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: The official --=jscam=-- thread

Post by NoQ » 03 Nov 2014, 04:44

They are more like stand-alone missions.
If we rename challenges to something else
"Missions" sounds good for me (:
If we rename challenges to something else, then use that screen to load up different items (the tool tips would explain what each "thing" does), we could then use the ini to tell WZ what to load, either mp or base.
I'd still wait for a while if the moment when scripts are given write-access to stats (?), because it's seems to be much nicer to have the whole tree inside the mission, rather than rely on two pre-defined variants.
Why the 80 char limit ?
Got used to it at work and liked it. With my screen layout, i overflow at around 105 chars; some lines still overflow at this width, eg. the highlighted line on the screenshot. I can remove the enforcing comment (and i don't like the tone of it myself), but i'd still limit myself, because not everybody has 27" 1920x1080, so they may want to increase font or just have less pixels.
Attachments
2014-11-03-053305_3200x1080_scrot.png

Post Reply