Page 7 of 11
Re: Mission Editor
Posted: 14 Apr 2009, 19:21
by lurker
CarRepairer wrote:Wasn't this the cause of the great jumpjet desync of '08?
Those were coroutines, sort-of-threads, running function
states, not just function objects.
Re: Mission Editor
Posted: 14 Apr 2009, 19:31
by Argh
Why is that a problem?
Because I need valid unitIDs immediately in a lot of the routines:
For example, I have routines like this, where the Unit being created is being assigned to a Group;
NewUnit = Spring.CreateUnit("Resistance_HeavyTrooper_Spawn", x - 8 ,y,z + 24, heading, team)
table.insert(OrderQueue,{unit = NewUnit})
copyCommandQueue(factory, NewUnit)
I'm sure there's a fairly easy way to translate this, I'll figure it out, I'm just frustrated and I'm very busy atm.
Re: Mission Editor
Posted: 14 Apr 2009, 19:41
by quantum
You can use Tobi's functions this way:
Code: Select all
DelayedCall(function()
NewUnit = Spring.CreateUnit("Resistance_HeavyTrooper_Spawn", x - 8 ,y,z + 24, heading, team)
table.insert(OrderQueue,{unit = NewUnit})
copyCommandQueue(factory, NewUnit)
end)
lurker wrote:CarRepairer wrote:Wasn't this the cause of the great jumpjet desync of '08?
Those were coroutines, sort-of-threads, running function
states, not just function objects.
Those were caused because "pairs" orders items passed by reference in a way that varies from computer to computer. The issue was in the iterator, and could have happened with function or table indices, if I understood correctly.
Re: Mission Editor
Posted: 14 Apr 2009, 20:18
by Argh
Ok, I have the first thing translated. Squads stay squads, it turned out all right, although I'm going to be nervous about introducing bugs at this late date, I'd rather see everything working perfectly in Missions.
I'll burn the next hour or two just getting it all shipshape, this is pretty vital atm.
Re: Mission Editor
Posted: 14 Apr 2009, 21:09
by Argh
Ran into another major problem. Seems like the function isn't being globalized properly.
And I don't want dozens of GameFrame() events, that could get expensive.
What am I doing wrong?
Code: Select all
local delayedCalls = {}
function DelayedCall(fun)
delayedCalls[#delayedCalls+1] = fun
end
gadgetHandler:RegisterGlobal("DelayedCall", DelayedCall)
When I attempt to run this from a separate file, it borks, says that the global function doesn't exist.
Re: Mission Editor
Posted: 14 Apr 2009, 21:30
by quantum
It's not expensive at all, it's not worth spending a minute optimizing. You can do it in each gadget.
If you want to share functions between gadgets, in general, you can use the GG table, like this:
Code: Select all
GG.MySharedFunction = function(a, b)
return a + b
end
-- in a different gadget:
two = GG.MySharedFunction(1, 1)
Re: Mission Editor
Posted: 14 Apr 2009, 21:50
by Argh
Meh, all right. I'm just worried, that GameFrame event's going to be in a lot of places. Checking a table that's almost always length zero, to be sure.
Re: Mission Editor
Posted: 15 Apr 2009, 02:58
by IllvilJa
quantum, what framework is this written in? Being a Linux user, I'm trying to figure out constructive ways to make this run in a more OS agnostic fashion, maybe not now but sometime in the future.
Yes, I know, the current windows-based framework is a requirement for you to be able to develop this mission editor so I don't have any problem with that but later on, at some point, it might be possible to migrate it over to something that is more portable? There are a bunch of viable strategies for that, hopefully one of them would work without causing issues for your development efforts.
(In the meanwhile, I can try to fire this up under Wine on Linux and report the result.).
Re: Mission Editor
Posted: 15 Apr 2009, 09:39
by imbaczek
It's probably WPF. WPF is good, like, really good. It's also quite similar to Silverlight, which already exists on Linux as Moonlight... don't get your hopes too high tho.
Re: Mission Editor
Posted: 15 Apr 2009, 13:42
by quantum
Yeah it uses WPF (Windows Presentation Foundation).
The GUI code is neatly separated from the rest, so I guess someone could re-write only the interface. But then, the GUI represents most of the work so it almost means starting over.
Re: Mission Editor
Posted: 15 Apr 2009, 21:31
by CarRepairer
I want to add something to my mission where one of four triggers (1, 2, 3 or 4) will be randomly chosen to be enabled at 20 minutes. Here is what I thought of:
At 20:00, trigger A is triggered.
It enables trigger 1 and B.
At 20:01 trigger B has a 75% chance of triggering.
It disables trigger 1 and enables 2 and C.
At 20:02 trigger C has a 66.6% chance of triggering.
It disables 2 and enables 3 and D.
At 20:03 trigger D has a 50% chance of triggering.
It disables 3 and enables 4.
I hope this helps, or if someone has a simpler way please share.
Re: Mission Editor
Posted: 16 Apr 2009, 19:40
by quantum
I don't see a better way. That's terribly inconvenient. I really need to make it easier.
Re: Mission Editor
Posted: 18 Apr 2009, 06:08
by DavetheBrave
This happens when I try to publish or update. Making mutator and testing work fine.
Re: Mission Editor
Posted: 18 Apr 2009, 12:26
by Licho
Checking, it looks you got something too long
Re: Mission Editor
Posted: 18 Apr 2009, 12:29
by Licho
Try it again
Re: Mission Editor
Posted: 19 Apr 2009, 06:17
by AF
DavetheBrave wrote:
This happens when I try to publish or update. Making mutator and testing work fine.
http://www.codinghorror.com/blog/archives/001239.html
epic failure in development.
Re: Mission Editor
Posted: 19 Apr 2009, 14:55
by quantum
If you want to have a field day, open the program and look at my GUI horrors

Re: Mission Editor
Posted: 20 Apr 2009, 20:09
by CarRepairer
quantum wrote:I don't see a better way. That's terribly inconvenient. I really need to make it easier.
I would need all 8 triggers no matter what, because I want to create a special unit in one of four different random spots, as well as create 4 different areas for
units are in area. The A,B,C,D triggers will create the unit (and destroy the previous ones), in addition to enabling/disabling the 1,2,3,4 which each have a different area. Yes it's a total of 8 triggers but there's really no other way. Better to enhance the GUI for collapsible triggers and other good stuff like that.
Re: Mission Editor
Posted: 20 Apr 2009, 23:19
by CarRepairer
Can I change the mod of my mission? If yes, what happens to units I created in the create units action if they no longer exist in the mod?
Re: Mission Editor
Posted: 21 Apr 2009, 14:51
by quantum
You can change it in the mission settings screen. Units that no longer exist in the mod will still be in the mission, but they get changed to the first unit type in the unit list.