The online racing simulator
How to load a marshall object via InSim?
Dear programmers,

I am working on a program for the LFS Sumo server, and we also plan to dynamically shrink the playing area via forbidden zones.

I have been fiddling around with the IS_AXM packet a little, and managed to place an object, but what I am struggling with to set the radius of the forbidden zone.

My ObjectInfo:

Heading = 128,
Index = 254,
X = 20,
Y = 1500,
Zbyte = 0,

I found that Index 254 is a marshall, but I'm not sure how to set the radius. Is it possible at all? When I place a marshall via Shift+u (when I listen to IS_AXM packets in the InSim) there also doesn't seem to be any radius settings in there.
From the LYT specification page:

if (Index==254) // a marshall circle (restricted area)
{
// Heading has its usual meaning

// Flags byte :
// bits 0 to 1 :
// 00 = no marshall
// 01 = standing marshall
// 10 = marshall pointing left
// 11 = marshall pointing right
// bits 2 to 6 :
// radius in metres (1 to 31 - shifted left by 2 bits)
}

Does this help or have you already checked this?
edit: So how exactly would that work? I have never done anything with bits before Shy
Yes, as it says in the spec, Flags byte - bits 2 to 6 - is the radius.
Ah yeah now I get it. I wasn't thinking straight. I will have a look at it. Sounds pretty straightforward now that I think of it actually. I'll keep this updated once I got news. Smile Thanks for the clarification.

edit: Another question: Would it be possible to view all objects in a layout? What I had in mind is to use a specific object (say a red post) to mark the centre of the sumo ring, and build a ring of forbidden zones around that via InSim. Otherwise it would just be hardcoded I guess (center of the ring in AU2 for example).
-
(Flame CZE) DELETED by Flame CZE
The bits/flags for marshal can be calculated as this:
(at least formula was correct in 5/5 test cases)


int marshalType = 3;
//possible values are:
//0=no dude (just the zone)
//1=no hands
//2=hand to left
//3=hand to right

int diameter = 24;
//possible values are: 2,4,6,8,10,...62
newObject.Flags = marshalType + ((diameter/2)*4);

Thanks for the help guys. As said yesterday when we were in the server, I did it in another way: pick a centre on the map and create a zone via insim where you're allowed to be. If you're outside the radius you are out.

I do have another question though, but I don't want to spam the forum with every question with a separate thread, so I'll ask it here.

Is it possible to detect when a race starts when the light is green? Right now I start a timer as soon as the race is restarted, but I then have X seconds where nothing happens because players are waiting on the green light. Is the time before green always the same on all tracks? Does it change with more/less people? I'm now using IS_RST to detect if the race gets restarted, but there's obviously also the delay from the countdown, and the lights after that. Would be nice if I could start my timer after the green light.
Quote :Is it possible to detect when a race starts when the light is green?

As far I could tell the delay between IS_RST and green light is random...

You could use quali or practice mode, then there are no lights at all, and do your own countdown and too-early-moving detection?
(For layout use the pit-start objects instead of grid-objects)
Quote from Gutholz :As far I could tell the delay between IS_RST and green light is random...

As Gutholz says it is always random, except on the drag strip tracks.
It would be unfair if the delay was accessible via InSim. The server owners could predict when the green light goes on to get better reaction times at starts Smile
Thanks for the feedback. I decided to build my own 'lights' and check if the players move before it's green.

How to load a marshall object via InSim?
(12 posts, started )
FGED GREDG RDFGDR GSFDG