Mission Editor - Page 7

Mission Editor

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Mission Editor

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mission Editor

Post 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.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Mission Editor

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mission Editor

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mission Editor

Post 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.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Mission Editor

Post 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)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mission Editor

Post 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.
User avatar
IllvilJa
Posts: 90
Joined: 08 Sep 2008, 00:01

Re: Mission Editor

Post 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.).
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Mission Editor

Post 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.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Mission Editor

Post 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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Mission Editor

Post 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.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Mission Editor

Post by quantum »

I don't see a better way. That's terribly inconvenient. I really need to make it easier.
User avatar
DavetheBrave
Posts: 281
Joined: 22 Jun 2005, 02:52

Re: Mission Editor

Post by DavetheBrave »

Image

This happens when I try to publish or update. Making mutator and testing work fine.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: Mission Editor

Post by Licho »

Checking, it looks you got something too long
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: Mission Editor

Post by Licho »

Try it again
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Mission Editor

Post by AF »

DavetheBrave wrote:Image

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.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Mission Editor

Post by quantum »

If you want to have a field day, open the program and look at my GUI horrors :P
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Mission Editor

Post 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.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Mission Editor

Post 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?
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Mission Editor

Post 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.
Post Reply

Return to “Game Development”