Jump to content

Recommended Posts

Posted (edited)

H'lo,

First attempt at mission building and figured I would try to make a race course, Redbull style. Figured it would be easy but the more I get into it the more difficult I am finding it to be.

 

Here is what I am shooting for:

Short course flown by 1 aircraft at a time. Maybe someday include ALL the Redbull rules (such as knife edge pylons and the such) but right now just want to get through the pylons and register a time with penalties for missed gates. I would like to get it to register at least 8 aircraft. With a race steward directing who can enter the course, who's on deck, etc. Eventually maybe a campaign/race season with different courses.

 

The 1st part I do have completed, BUT only for 1 aircraft. I think I can get the steward part worked out but atm have some other issues in my working model that I want to get ironed out. First and foremost is the trigger areas are small and thus with the 1 per second checks, sometimes flown through without updating. Bigger round circle area would allow someone to cheat the pylons. I have seen some suggestions to use code to get it to check more times per second, but limited examples and my programming skills being extremely basic and rusty to boot, I haven't figured out how to implement it. I understand the concepts, but don't have the knowledge to put it into action.

The other is to have time computed more accurately, which I know again will have to be done with code. I have MIST in the mission to try and utilized its capabilities but haven't been able to come up with the code to make anything work.

 

If anyone has any ideas/suggestions or more importantly code to help this project, would greatly appreciate it. They will of course get full credit for their work.

 

I have attached the mission and a track (to show off the course, and how to get through it). The track is based off the 2010 Redbull course design, stretched out for the P51. I started off in the air but plan for it to be a ground start based off the race stewards directions. Gate 1 MUST register for the timer to start, up to 3 gates can be missed, imposing a 10 second penalty per gate. Any more and it will disqualify you for the run. Gate 17 (final gate) stops the timer, if it doesnt register, the time will stop when you exit the race area (larger trigger area encompassing the course). ATM there is no in flight directions on which gates are which. So, watch the track or checkout the Area map from the 2010 New York race.

 

Thanks again for any comments/suggestions you can provide,

 

 

 

Files removed, mission is posted in the P51D Missions forum.

Thanks.

Edited by Shahdoh
Mission updated with working multiplayer and timed laps to a tenth of a second
Posted

I had started working on an air race script when I first learned of the scripting engine. But it was one of the first things I ever wrote in LUA, so its kind of a mess. It was much more complicated in its implementation as I wanted to store a database of tracks along with a database of player laptimes on said tracks. Granted the initial design was more of a "reno air race" than the Red Bull Aerobatic style....

 

But basically you will want to do most of the thing in Lua because it is more precise. For example with Mist you can check if a point is inside of a rectangle shape which would be more accurate for gate checking. Also you can run the check 1000 times a second to get accuracy into the thousandths, (I only recommend 100 times a second).

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted (edited)

Thanks for the reply, yeah, that's what I am seeing, but now how to do it? I tried this bit of code to check the polygon shaped zone, created by 4 small boats on the water, but with no success.

 

 

 

Do

mist.flagFunc.units_in_polygon{

units = {mist.DBs.unitByName['RB #1']}, -- unit name of pilot

zone = {[1] = mist.DBs.unitByName['G11'].point, -- unit names of the boats at first pylon

[2] = mist.DBs.unitByName['G12'].point,

[3] = mist.DBs.unitByName['G13'].point,

[4] = mist.DBs.unitByName['G14'].point,},

flag = 1001,

stopflag = 2001

maxalt = 300,

interval = .1}

if trigger.misc.getUserFlag(1001) == true then

trigger.action.outText('Gate 1 \n Timer started',5)

end

end

 

 

This can be found in the actions for the trigger: Gate 1 chk

 

This isn't working, but I assume the interval = .1 will check 100 times per second?

 

Attached is a non working version of the race where I am trying to use mist functions.

Edited by Shahdoh
Removed outdated mission file...
Posted
Thanks for the reply, yeah, that's what I am seeing, but now how to do it? I tried this bit of code to check the polygon shaped zone, created by 4 small boats on the water, but with no success.

 

 

 

Do

mist.flagFunc.units_in_polygon{

units = {mist.DBs.unitByName['RB #1']}, -- unit name of pilot

zone = {[1] = mist.DBs.unitByName['G11'].point, -- unit names of the boats at first pylon

[2] = mist.DBs.unitByName['G12'].point,

[3] = mist.DBs.unitByName['G13'].point,

[4] = mist.DBs.unitByName['G14'].point,},

flag = 1001,

stopflag = 2001

maxalt = 300,

interval = .1}

if trigger.misc.getUserFlag(1001) == true then

trigger.action.outText('Gate 1 \n Timer started',5)

end

end

 

 

This can be found in the actions for the trigger: Gate 1 chk

 

This isn't working, but I assume the interval = .1 will check 100 times per second?

 

Attached is a non working version of the race where I am trying to use mist functions.

 

Try this:

 

do
mist.flagFunc.units_in_polygon{
	units = {'RB #1'}, 
	zone = {[1] = mist.DBs.unitsByName['G11'].point, -- unit names of the boats at first pylon
	[2] = mist.DBs.unitsByName['G12'].point,
	[3] = mist.DBs.unitsByName['G13'].point,
	[4] = mist.DBs.unitsByName['G14'].point,},
	flag = 1001,
	stopflag = 2001
	maxalt = 300,
	interval = .1
}
if trigger.misc.getUserFlag(1001) == true then 
	trigger.action.outText('Gate 1 \n Timer started',5)
end
end

 

Don't have the time to test it right now though, but the above script has fixes to several of the problems you had in the first script.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Posted

Thanks for the feedback, with your corrections, and a bunch of troubleshooting on other issues I finally got the polygon gate checks working as intended. At the moment, I am getting a bunch of errors when MIST is initializing but once its done, mission runs fine after that.

 

Next major thing on the to do list is getting the timer accurate to 1/100 of a second. NO idea how to do that, I need to start a timer at gate 1, stop it at gate 17, add penalty seconds and then display. ATm I am using a continuous increment 1 per second timer.

 

After that, how to variable out the pilot so other clients can race.

 

Anyways, 1 big step forward, thank you.

 

PS: Anyone try the course from the 1st post? It does work, just the gate checking can get iffy at times. Once I get this updated version cleaned up a bit will post it.

 

/salute

Shahdoh

Posted (edited)

As the mission is loading, this pops up:

[string "do..."]:2: attempt to index global 'mist' (a nil value)

 

Click ok or press enter and it reoccurs about 35 times. These errors did not occur when I had no code at all, just mist initializing. Also, once they are done at loadup, the rest of the mission, gate checks etc, all work just fine. From what I can guess, its looking for something that is not there, but I have been unable to find out what it is.

 

FIXED! apparently it was doing gate checks before mist and or all the vehicles were loaded. I changed the condition and the errors went away. I have reloaded the fixed version.

Edited by Shahdoh
Removed outdated mission file...
Posted

Original post has current mission. I now have multi-player support (still just 1 being tracked on the course at a time, per RedBull style rules) and have a timer in there accurate to 1/10th of a second. Split times are provided at each pylon as well. Encourage all interested to please download and provide feedback. Still some more things I want to put in like the race steward directions, Keeping fastest splits and times posted and log each player up to 3 or 4 rounds to attempt to get fastest time to win. Any and all suggestions are welcome.

 

Thank you,

Shahdoh

Posted

Testing has shown an issue with my timing. The time is coming up with the tenth of a second, but its almost always the same at the same gates with finishes almost always ###.6

 

I stripped away the trigger codes down to where I am setting the time. Each of these lines are in seperate triggers at different points in the race:

 

rb_start = timer.getTime() --From Gate 1 chk

 

rb_split2 = timer.getTime() - rb_start --from Gate 2 chk

 

rb_stopped = timer.getTime() - rb_start --from Gate 17 chk, the finish line

 

rb_total = penalty + rb_stopped --from 2nd Redbull Batumi 2010 ' yeah I know I have 2 triggers same name, will fix

 

The op has the mission with the complete code this is from. I have tried changing the interval on the gate checks from .10 to .01 with no changes to the displayed time. Would appreciate any help you can provide.

 

Thanks

Posted

My best guess is that your timing is still based on triggers. As a result the times will be all at 1 second intervals. You have to completely free yourself from triggers if you want anything to be checked more than once a second.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Ok, any samples of code on how I would accomplish this then? The code I have in there has already pushed my knowledge of programming, I know, its not much. Any bit would help. Thanks..

Posted (edited)
Ok, any samples of code on how I would accomplish this then? The code I have in there has already pushed my knowledge of programming, I know, its not much. Any bit would help. Thanks..

Grimes is right, for a good air race mission that has precise timing, a track that is re-transversable, stores best times, etc, you really need to:

33971056.jpg

Don't get me wrong, triggers are great and useful, and when I make missions I still use quite a number of them. But an air race mission just doesn't lend itself to being easily implemented with triggers.

 

Anyway, I don't have time right now to work up any kind of full example, but Grimes speaks of using Lua to achieve more precise timing. The following shows how to get started with this in Mist:

 

function mainLoop()
--<Your code>
end

mist.scheduleFunction(mainLoop, nil, timer.getTime(), 0.01)

 

Any Lua code placed within the mainLoop function will run about 100 times a second- triggers only run 1 time per second.

 

You can get unit positions with Object.getPosition, and check if they are in polygonal zones with mist.pointInPolygon, and get the exact mission time of various events/conditions with timer.getTime - and all this at a rate 100 times faster than triggers could do it.

 

If you are in fact interested in learning the game's Lua scripting engine in more detail, an air race mission is a pretty good place to start- you can start with something fairly simple and scale it up over time as you learn more.

Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Posted

Thank you for the response. Its the functions, where and how to implement them thats not a trigger, that I an unfamiliar with. I have the polygon zones in place already so it sounds like I am part way there.

 

The Function code itself, I assume you place it right after Mist initializes, would it be a once or continuous type action? If you have this type of timing in a mission already would love to see it. I think I could decipher it enough to get what I need for mine.

 

Again, thanks for the help.

Posted (edited)

Wow...just ran through this course what a fking blast...you guys have to try it...its great fun...had about 6 of us racing time trials against each other...again what a blast....

 

:thumbup::thumbup::thumbup::thumbup:

 

 

Here is another Redbull Race...map..Monument Valley mission

 

rbarareamap3dversion.jpg

 

 

Again Great Fun..flying the race course...video to follow

Edited by Double_D

[/Table]

Recruiting for Aerobatic Team/Fighter Group...

Posted (edited)
Thank you for the response. Its the functions, where and how to implement them thats not a trigger, that I an unfamiliar with. I have the polygon zones in place already so it sounds like I am part way there.

 

The Function code itself, I assume you place it right after Mist initializes, would it be a once or continuous type action? If you have this type of timing in a mission already would love to see it. I think I could decipher it enough to get what I need for mine.

 

Again, thanks for the help.

 

No, if you put it on a continuous trigger, you would end up locking up the game after a very short period, as every second you'd add a duplicate, 100-time-a-second, loop. It just needs to be run once, and then mainLoop will start looping forever.

 

If can you upload the latest version of the mission, I can maybe try spending some time on it.

Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Posted (edited)

Thank you much, here is the very latest. includes a briefing map of the layout of the course.

Edited by Shahdoh
Removed old version, Current mission is posted in the P51D Missions forum.
Posted

Whoot, success, finally got the timer working accurately to hundredths of a second. Standby and should have a finished race in the next few days. Thanks Speed and Grimes for the help and materials they have provided on these web pages..

 

Have to take a break now, my brain hurts from the expansion of coding knowledge..

  • Like 1
Posted
Whoot, success, finally got the timer working accurately to hundredths of a second. Standby and should have a finished race in the next few days. Thanks Speed and Grimes for the help and materials they have provided on these web pages..

 

Have to take a break now, my brain hurts from the expansion of coding knowledge..

 

That's great mate, now u can help me! (wink)

 

My goal is to let each racer see his lap time and then the total when race completes...U think you can hack that?

Midnite Signature.jpg

Posted (edited)
Whoot, success, finally got the timer working accurately to hundredths of a second. Standby and should have a finished race in the next few days. Thanks Speed and Grimes for the help and materials they have provided on these web pages..

 

Have to take a break now, my brain hurts from the expansion of coding knowledge..

 

Nice!

 

I wish I could have been more help, but I've been pretty busy.

 

If you're interested in doing more Lua, the #1 thing I can recommend is to buy a Lua manual. The first edition is available for free online, but nothing beats a physical copy: http://www.amazon.com/Programming-Second-Edition-Roberto-Ierusalimschy/dp/8590379825

 

It's very well written and easy to understand.

Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

  • 10 years later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...