Those were coroutines, sort-of-threads, running function states, not just function objects.CarRepairer wrote:Wasn't this the cause of the great jumpjet desync of '08?
Mission Editor
Moderator: Moderators
Re: Mission Editor
Re: Mission Editor
Because I need valid unitIDs immediately in a lot of the routines:Why is that a problem?
For example, I have routines like this, where the Unit being created is being assigned to a Group;
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.NewUnit = Spring.CreateUnit("Resistance_HeavyTrooper_Spawn", x - 8 ,y,z + 24, heading, team)
table.insert(OrderQueue,{unit = NewUnit})
copyCommandQueue(factory, NewUnit)
Re: Mission Editor
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)
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.lurker wrote:Those were coroutines, sort-of-threads, running function states, not just function objects.CarRepairer wrote:Wasn't this the cause of the great jumpjet desync of '08?
Re: Mission Editor
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.
I'll burn the next hour or two just getting it all shipshape, this is pretty vital atm.
Re: Mission Editor
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?
When I attempt to run this from a separate file, it borks, says that the global function doesn't exist.
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)
Re: Mission Editor
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:
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
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
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.).
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
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
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.
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.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Mission Editor
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.
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
I don't see a better way. That's terribly inconvenient. I really need to make it easier.
- DavetheBrave
- Posts: 281
- Joined: 22 Jun 2005, 02:52
Re: Mission Editor

This happens when I try to publish or update. Making mutator and testing work fine.
Re: Mission Editor
Checking, it looks you got something too long
Re: Mission Editor
http://www.codinghorror.com/blog/archives/001239.htmlDavetheBrave wrote:
This happens when I try to publish or update. Making mutator and testing work fine.
epic failure in development.
Re: Mission Editor
If you want to have a field day, open the program and look at my GUI horrors 

- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Mission Editor
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.quantum wrote:I don't see a better way. That's terribly inconvenient. I really need to make it easier.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Mission Editor
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
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.