Campaign with lua
Campaign with lua
This thread is for everyone replaying the campaign with the lua2 branch to test the lua scripts for the campaign and report any impressions and bugs.
-in alpha 2 ("power surge") there was a New Paradigm sensor standing around at the SE corner (where NP would attack from in alpha 6). Is this supposed to happen?
- in alpha 5 (where you first meet the new paradigm) and 6, the new paradigm seems strangely apathetic. In alpha 5, after I kill their commander, they don't come out of their castle anymore; they keep producing units, but these just stay inside and wait for me to storm the castle. In alpha 6, they're supposed to attack me from the southeast, but they just stand arrayed in their canyon and wait for me to come in and get them. Perhaps the latter has something to do with me killing their sensor in alpha 2. Note to self: replay with letting it live.
-in alpha 2 ("power surge") there was a New Paradigm sensor standing around at the SE corner (where NP would attack from in alpha 6). Is this supposed to happen?
- in alpha 5 (where you first meet the new paradigm) and 6, the new paradigm seems strangely apathetic. In alpha 5, after I kill their commander, they don't come out of their castle anymore; they keep producing units, but these just stay inside and wait for me to storm the castle. In alpha 6, they're supposed to attack me from the southeast, but they just stand arrayed in their canyon and wait for me to come in and get them. Perhaps the latter has something to do with me killing their sensor in alpha 2. Note to self: replay with letting it live.
Re: Campaign with lua
As you play campaign with lua, you will notice some messages on stdout/stderr or stdout.txt/stderr.txt saying "stub: NNN", where NNN is some function name. This means function NNN is called but not yet ported. If you post the names of those functions here, I'll port them for you
Re: Campaign with lua
OK, it doesn't.Samowar wrote:Perhaps the latter has something to do with me killing their sensor in alpha 2. Note to self: replay with letting it live.
@stubs:
stub: groupMember
stub: setGroupSecondary
stub: _
stub: showConsoleText
stub: flushConsoleMessages
stub: randomiseSeed
stub: initAllNoGoAreas
stub: addDroidToMissionList
As for the apathetic AI in mission 5, I've attached a savegame. See for yourself.
EDIT: Some other strange things happened in mission 5:
- The research facility inside then NP base looked strangely unfinished.
- When I destroyed the factory, an artefact appeared - at the site of the former research facility.
- Attachments
-
- apathetic.tgz
- AI sits around and waits to be killed
- (178.09 KiB) Downloaded 380 times
Re: Campaign with lua
Thank you for your reports, please don't stop!
They are really helpful for furthering development on the lua branch.
They are really helpful for furthering development on the lua branch.
Re: Campaign with lua
With r9783:
EDIT: Perhaps it's no error at all; I thought the AI was to attack immediately at the start of alpha 6 and devastate the southern part of the map, but reading the walkthrough I realize it could well be they wait for some minutes. If I attack them, they head straight for my HQ.
AI is still apathetic.error |06:29:16: [luaWZ_dofile] loading Lua file: script/data/cam1a-c_logic.lua:313: ')' expected near '['
error |06:29:16: [report]
script/glue.lua:79: failed loading file
stack traceback:
[C]: in function '__dofile'
script/glue.lua:79: in function 'dofile'
script/data/cam1a-c.lua:206: in main chunk
EDIT: Perhaps it's no error at all; I thought the AI was to attack immediately at the start of alpha 6 and devastate the southern part of the map, but reading the walkthrough I realize it could well be they wait for some minutes. If I attack them, they head straight for my HQ.
Re: Campaign with lua
When do you see this error? There seems to be a conversion error there, since a variable at that line got '_' added to it for no good reason I could see.error |06:29:16: [luaWZ_dofile] loading Lua file: script/data/cam1a-c_logic.lua:313: ')' expected near '['
Re: Campaign with lua
It's an conversion error, the variable should be checked in the function itself. It's one of the weirder things of the old script system. I'm working on it now.Per wrote:When do you see this error? There seems to be a conversion error there, since a variable at that line got '_' added to it for no good reason I could see.error |06:29:16: [luaWZ_dofile] loading Lua file: script/data/cam1a-c_logic.lua:313: ')' expected near '['
Re: Campaign with lua
What's "lua"?
- lav_coyote25
- Professional
- Posts: 3434
- Joined: 08 Aug 2006, 23:18
Re: Campaign with lua
Found it. Ironically, it is the very changeset directly after trunk was merged into lua...Samowar wrote:I suppose this hasn't anything to do with lua, probably it was a bug that was there when trunk was merged into lua and has been corrected since in trunk. I didn't manage to find that changeset, however.
EDIT: Arrgh, edited instead of quoted. The original contents of the post were as follows.
- Repair Facility also looks strange when built by myself. Not the fault of lua per se. See above
- AI being apathetic in alpha 6 is definitely lua's fault; loading the start-of-mission-savegame in trunk starts an immediate attack.
Would it be possible for someone to merge trunk into lua again in svn? and wouldn't it make sense to include the .lua scripts into svn too?
Re: Campaign with lua
Hm... somehow the strike team never gets assembled, although it's all there in the script. Debugging with "break grpJoin if (psDroid->player==1)" shows suspiciously little activity at the start of the game when loading the end-mission-savegame (to be exact: Some Mortars are added to a group, but not a single Rocket-Bug).Samowar wrote:- AI being apathetic in alpha 6 is definitely lua's fault; loading the start-of-mission-savegame in trunk starts an immediate attack.
btw: This error always crops up at loading a game:
error |06:46:17: [scrRandomiseSeed] A script is trying to set the random seed with srand(). That just doesn't make sense.
Commanders work now; they used not to which was in my post I inadvertedly deleted/edited and I forgot to restore that part.
Re: Campaign with lua
...and now I know why. At least partially. Somehow, when the second team (i.e. the rocket-bugs) is about to be assembled, luaWZObj_checkgroup reaches the following line:Samowar wrote:Hm... somehow the strike team never gets assembled, although it's all there in the script.
Code: Select all
1760 luaL_error(L, "argument %d is not a group (not even a table)", pos);
I don't know how this was originally intended, but wouldn't it be better to handle even errors in functions which were called from lua scripts with "Assert or return"? That way at least we'd know where the script fails.
Re: Campaign with lua
Is anyone listening at all? Seems I'm the only one to post here in recent times.
Anyway, I've fixed some things to make scripts better debuggable (whose idea was it to throw out the backtraces in event.lua? You effectively "swallow" all script errors) and found the direct cause for the script error in alpha 6. However, as I now have script error output, I've discovered a huge flaw: Lua arrays are 1-based, so some of the converted code will attempt to read the zeroeth index, which is most probably not initialized. Example:
EDIT: Seems I've opened a box of Pandora...
Seems the pause() function doesn't really work. You can however achieve the same effect with the following contraption:
And now a question to the devs: Do you plan on eventually writing an improved script converter that fixes all those flaws automatically? Because in that case I needn't bother fixing the scripts manually. If not, however, perhaps it would make sense to put the lua scripts under version control.
Fixes for script debugging attached
Anyway, I've fixed some things to make scripts better debuggable (whose idea was it to throw out the backtraces in event.lua? You effectively "swallow" all script errors) and found the direct cause for the script error in alpha 6. However, as I now have script error output, I've discovered a huge flaw: Lua arrays are 1-based, so some of the converted code will attempt to read the zeroeth index, which is most probably not initialized. Example:
Code: Select all
script/data/cam1c_logic.lua:1002: attempt to index field '?' (a nil value)
stack traceback:
script/data/cam1c_logic.lua:1002: in function <script/data/cam1c_logic.lua:978>
(tail call): ?
[C]: in function 'xpcall'
script/version.lua:185: in function 'call_with_backtrace'
script/event.lua:130: in function <script/event.lua:123>
script/data/cam1c_logic.lua:894: argument 1 is not a group (not even a table)
stack traceback:
[C]: in function 'groupCountMembers'
script/data/cam1c_logic.lua:894: in function <script/data/cam1c_logic.lua:890>
(tail call): ?
[C]: in function 'xpcall'
script/version.lua:185: in function 'call_with_backtrace'
script/event.lua:130: in function <script/event.lua:123>
Code: Select all
attempt to yield across metamethod/C-call boundary
stack traceback:
[C]: in function 'yield'
script/version.lua:177: in function 'pause'
script/data/cam1a_logic.lua:426: in function <script/data/cam1a_logic.lua:424>
(tail call): ?
[C]: in function 'xpcall'
script/version.lua:185: in function 'call_with_backtrace'
script/event.lua:130: in function <script/event.lua:123>
Code: Select all
function scavAttack2delayed()
deactivateEvent(scavAttack2delayed)
conditionalEvent(removeObj1, "droidInRange(player, 4928, 6592, 5 * 128)", 2.0)
addMessage(MissionBrief2, MISS_MSG, player, true)
addMessage(obj1Msg, PROX_MSG, player, false)
orderGroupLoc(scavGroup, DORDER_SCOUT, 2100, 6700)
end
function scavAttack2() -- event at line 556
playSound(incomingSnd, player)
delayedEvent(scavAttack2delayed, 20/10.0)
deactivateEvent(scavAttack2)
end
conditionalEvent(scavAttack2, "droidInArea(player, 2496, 6080, 4928, 7232)", 0.5)
Fixes for script debugging attached
- Attachments
-
- debuglua.diff
- Restore backtrace ability of scripts.
- (1.23 KiB) Downloaded 360 times
-
- debuglib.diff
- Make lib/lua/ debuggable. Proved unnecessary in the end, but never hurts (I hope)
- (896 Bytes) Downloaded 340 times
Re: Campaign with lua
Yes, people are listening, it is just we are all rather busy (with real world), and the forums are pretty much the last place anyone looks, because of time constraints.Samowar wrote:Is anyone listening at all? Seems I'm the only one to post here in recent times.
Will try to get a answer for you, the next time I see Gerard.
If you think the converter scripts are broken, it is best to open a ticket about that, so it will get noticed, the other devs tend to check tickets before forums.
and it ends here.
Re: Campaign with lua
Yes, with great interest.Samowar wrote:Is anyone listening at all?
If you look at the lua code converted from VLO files, they use zero-indexed arrays (which are legal in lua, but not exactly encouraged or recommended) but at great cost to code readability. So we should probably change this.Samowar wrote:However, as I now have script error output, I've discovered a huge flaw: Lua arrays are 1-based, so some of the converted code will attempt to read the zeroeth index, which is most probably not initialized.