The online racing simulator
"3D" InSim buttons
(19 posts, started )
"3D" InSim buttons
This is another one of my "must-try-some-day" kind of projects. I've been playing with the idea to make an IS_BTN appear like an actual object in 3D space and project it correctly on the screen. I guess that such a system could be very useful to dynamically mark various places on the track. Provided that the server has enough bandwidth to resend buttons often enough there should be no problem using it online.

This is a very early version I hacked together today, so it has some quite apparent issues

http://youtu.be/skIsbd7LwY8
is very neat, laggy but neat.
The demo runs at 5 FPS, but it's not a problem to let it run at say 25 but it would hog the bandwidth quite a bit because everything is done through InSim. I might upload some smoother demo once I get the worst problems sorted out...
Cooooooool
Ehhmm... This is quite normal on cruise servers like TC?
Quote from cargame.nl :Ehhmm... This is quite normal on cruise servers like TC?

I honestly don't know, but I bet that they don't supply an opensource library for this (nor do I ATM, but I will once it's done)
Very cool Would be nice if it kept the text un-squished, but having played with buttons I totally understand the issues with that :<

Quote from cargame.nl :Ehhmm... This is quite normal on cruise servers like TC?

Anything else us non-cruisers may have missed being innovated? (That's not sarcasm, genuinely wondering)
I have the feeling that cargame have not been bothered to watch the video and he is talking about buttons that appears at certain coordinates (aka street lights, shops)

Or maybe as the_angry_angel says finally the cruisers have done something innovating xD
Quote from Whiskey :Or maybe as the an[g]ry angel says finally the cruisers have done something innovating xD

It had to happen eventually. But I'm pretty sure they are not doing this on any server that I've been on, not that there are many areas to innovate except for cruse these days. With the rest of the game being stagnate.
This is "innovation" i saw about 2 years ago (but only 2D coords) and done it 1,5 year ago ))
wow i've been trying to replicate this for months that's amazing work good stuff, just a shame you managed to do it before me
Maybe it will help you do first step

This code is not good but me not needed it in my projects and i don't optimize it.

coding in lua
func_mci.at_screen = function(mci)
for k,player in pairs(ginfo) do

-- coordinates in meters!

if obj == nil then
obj = {}
obj.x = -32.0
obj.y = -990.0
end

--Look at player. Comment for use coordinate of 'obj'
local username = "repeat"
if (player.uname == username) then
obj.x = tonumber(string.format("%.1f",player.x/65536))
obj.y = tonumber(string.format("%.1f",player.y/65536))
end

if (player.uname ~= username and player.plid) then

local car = {}
car.x = tonumber(string.format("%.1f",player.x/65536))
car.y = tonumber(string.format("%.1f",player.y/65536))

local h = tonumber(string.format("%.1f",player.heading/32768*180))

local v = (obj.y-car.y)/(obj.x-car.x)
local a = math.atan(v) *180/math.pi -- in degrees
local signX = math.abs(obj.x-car.x)/(obj.x-car.x)

if (signX == -1) then a = 90 + a; else a = 270 + a; end


-- correction
if (a >= 360) then a = 0; end

a = tonumber(string.format("%.1f",a))

-- изменяем предела от -180 до 180
if (h > 180) then h = h - 360; end
if (a > 180) then a = a - 360; end

v = h-a

if (v > 180) then v = v - 360
elseif (v < -180) then v = v + 360
end


distance = tonumber(string.format("%.1f",math.sqrt((obj.x-car.x)^2+(obj.y-car.y)^2)))

--local text = ginfo[k].uname.." "..distance
--luaLFS:btn(1, 255, (100+k), 0, 32+0, 0, 0, 145+k*10-(#ginfo*10), 200, 7, text)

local fov = 90
local c = (fov/2)/100
if (distance <= 250) and (v >= (-fov/2)) and (v <= (fov/2)) and (player.uname ~= username) then
local text = "^1is here"
local len = text:len()
local x = math.ceil(100+(v/c)-len)
if (player.at_screen == nil) or (x ~= player.at_screen) then
luaLFS:btn(2, player.ucid, (0), 0, 32+0, 0, x, 80, len*2, 7, text)
ginfo[k].at_screen = x
end
elseif (player.at_screen) then
luaLFS:bfn(0, player.ucid, (0), 0)
ginfo[k].at_screen = nil
end


end
end
end

Quote from Whiskey :I have the feeling that cargame have not been bothered to watch the video and he is talking about buttons that appears at certain coordinates (aka street lights, shops)

No I didn't. I think you didn't bother to connect to TC. Or maybe other cruise servers working with InSim alerts above cars which get bigger when you come closer.

Quote from the_angry_angel :
Anything else us non-cruisers may have missed being innovated? (That's not sarcasm, genuinely wondering)

I don't know... Its not that I am a cruiser, sometimes you just have to take a look what others are making in/from this simulator. Sometimes it only takes a few minutes to learn/experience something.

And it's not that they bite on cruise servers or any other server
Quote from cargame.nl :Or maybe other cruise servers working with InSim alerts above cars which get bigger when you come closer.

Just so we're clear, scaling buttons proportionally to distance does not necessarily mean 3D projection. What I'm going for an algorithm that will correctly project arbitrary polygon on a flat plane. Given the very constricting limitations of IS_BTNs this might seem like a hell of an overkill, but such a flexible algorithm could be used for much more interesting stuff than a few floating buttons.
Quote from MadCatX :Just so we're clear, scaling buttons proportionally to distance does not necessarily mean 3D projection.

I'm not the one with a Youtube movie calling it "3D", do I? Only thing I said is that I've already seen exactly this stuff on a cruise server.

Some others here suddenly do all kinds of assumptions. Can't do anything about that, sorry

.
Quote from cargame.nl :I'm not the one with a Youtube movie calling it "3D", do I? Only thing I said is that I've already seen exactly this stuff on a cruise server.

He's not just scaling proportionally to distance though, he's also doing horizontal scaling based on the relative plane angle to fake the impression of looking at it from the side.

TC does have buttons that are scaled based on distance (easy) and others that physically track the location/position of other cars (not particularly complex trig).
I don't know if any other cruise servers have done anything similar or taken it further. AFAIK, one or two race InSim programs have implemented buttons that track a specific point on the track, but no scaling.

What MadCatX is doing (so far) is a further step that's a little more complex still that gives a bit more of an impression of '3D'.
How do you cope with differing view points and FOV settings?
I just estimate the POV at the moment, but that can be fine-tuned pretty easily. Default FOV in LFS is set to 90 degrees in so that's what I'm using for the time being. I didn't do any testing with different FOV values so far but the algorithm should have no problem working with any FOV in <0; 180> range.
Looks a pretty cool idea. I reckon higher up would be better tho, cause it does look a tad intrusive at times..

"3D" InSim buttons
(19 posts, started )
FGED GREDG RDFGDR GSFDG