Jump to content

Traffic Editor (tool for making custom traffic)


Wojak

Recommended Posts

Posted

Na attempt of creating a traffic resource from scratch – not random, but just something to add some spice to the maps

I think I solved the biggest problem (a relatively cheap way of syncing them undependably of any client), but it needs some tweaks and a user friendly (idiot proof) user interface in map editor

Posted

unlike complete gamemodes i think this should be released,after all its more of a tool for better maps in general, and adds possibility to be creative.

good work.

Posted
unlike complete gamemodes i think this should be released,after all its more of a tool for better maps in general, and adds possibility to be creative.

good work.

I think that too, it's not a simple good script, it's a tool that should fix Community questions.

Posted

to release it, I need to add the proper editor interface, and maybe some exported functions and events

and of course testing... (currently i tested it with two players online including me)

I can just say that it will not be released in 2011 ;)

Posted

thank You for the idea, I've implemented it and it's a bit better, but every vehicle has a diferent mass (and inertia) so they react diferent on the curves (i don't want to over complicate it though)

Posted

That doesn't really matter, and gives the impression of "realism" (if every vehicle would turn exactly as the others, would be VERY unrealistic, drivers are not all clones of the same person).

Posted (edited)

i didn't test it, and there's some probability i left in some silly bug, but this could improve the driving alot by emulating float control.

local controls={} 
local realcontrolvalues={} 
local controlframecount={} 
  
function emulateAnalogControl(ped,control,float) 
    if not controls[ped] then controls[ped]={} end 
    if not realcontrolvalues[ped] then realcontrolvalues[ped]={} end 
    if not controlframecount[ped] then controlframecount[ped]={} end 
    realcontrolvalues[ped][control]=getPedControlState(ped,control) and 1 or 0 
    controlframecount[ped][control]=1 
    if float then 
        controls[ped][control]=float 
    else 
        setPedControlState(ped,control,false) 
        controls[ped][control]=nil 
        realcontrolvalues[ped][control]=nil 
        break 
    end 
end 
  
addEventHandler('onClientRender',root,function() 
    for k,ped in pairs(controls) do 
        for n,control in pairs(ped) do 
            local tempavg1=(realcontrolvalues[k][n]*controlframecount[k][n]+1)/(controlframecount[k][n]+1) 
            local tempavg2=(realcontrolvalues[k][n]*controlframecount[k][n])/(controlframecount[k][n]+1) 
            if math.abs(tempavg1-control)abs(tempavg2-control) then 
                setPedControlState(ped,control,true) 
                realcontrolvalues[k][n]=tempavg1 
            else 
                setPedControlState(ped,control,false) 
                realcontrolvalues[k][n]=tempavg2 
            end 
            controlframecount[k][n]=controlframecount[k][n]+1 
        end 
    end 
end) 
  

PS: higher fps=more accuracy

Edited by Guest
Posted
i didn't test it, and there's some probability i left in some silly bug, but this could improve the driving alot by emulating float control.

--script--

PS: higher fps=more accuracy

I know it's not a bug, but I don't like the look of a double for loop in onClientRender handler function and the idea of running it on all clients at once...

for me: more operations per second = lower FPS (I think not only for me)

If i find it necessary, i will come up with somthing more efficient (less accurate, but hardly noticeable)

btw, where is the "ped" table?

btw2, thank you all for positive comments :)

Posted

ped is a table in main table, which contains all controls that you're going to handle.

if you're using this of accelerate and brake buttons, with 10 peds syncered per player, it'll be 20loops only.

and, as you see you're not forced to call the func for all players, just the syncer.

Posted

i'm quite happy with the small vehicles behavior, however the big, heavy ones will need some more attention (they just need to take the curve sooner)

i think i will also test some other vehicle types (boats and trains)

My test server should be open tomorrow at 18:00 Warsaw time (search for "wojak" in the server browser)

Posted

so i tested it, and indeed the problem is nothing else then sync and bandwidth.

with even few cars the syncing is bugging out seriously, no velocity seems to be applied at all.

Posted

from my perspective, when other player was the suncer, the velocyty was synced, but updated every half second

i think it would look better on dedicated server, and the only thing that need to be synced manualy are left and right controll states

  • 2 weeks later...
  • MTA Team
Posted

How is the editing interface? You should make it similar to how rcg has made it, except the waypoints is only shown at the spawn point and when you click on the spawn point it shows all the waypoints connected to it.

Posted
How is the editing interface? You should make it similar to how rcg has made it, except the waypoints is only shown at the spawn point and when you click on the spawn point it shows all the waypoints connected to it.

I'm considering creating an independent tool for making the paths, I think it will be esier to restrict some element propertys that way, but the maps will be in the standard map editor format though.

  • 2 months later...
Posted
It really looks Awesome dude, how is the progress going on this?

not as fast like I would like, but forward

recently I've designed the GUI layout of the interface, and started to script the buttons (i want to sync the GUI in all clients, so it looks like the patch creator may be more complicated than the interpreter part)

Once the patch creator is done, i can get back to the interpreter, and it should be down hill from there

Posted

Glad to hear you are still working on it.

If you ever need a tester or anything, just let me know.

Would love to help in any way possible .

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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