Board index FlightGear Development AI Traffic

AI Cars

Intelligent, computer controlled vehicles that drive/fly over the planet!

AI Cars

Postby Pakistan-1 » Wed Mar 18, 2015 4:24 am

Is It possible to have AI Cars,Busses,Trucks,Trains and Ships moving around on roads railways and Airports to make the Simulator more lively?
User avatar
Pakistan-1
 
Posts: 498
Joined: Tue Jun 18, 2013 3:49 am
Location: Hong Kong
Callsign: DocDMG,PK1,MIA2020
Version: 3.7
OS: Windows 10

Re: AI Cars

Postby Thorsten » Wed Mar 18, 2015 7:45 am

Yes, you're going to need properly uv-mapped roads though, which are supposed to be rolled out in a future scenery release (at which point we will add traffic effects to roads - Emilian has written one for the Innsbruck scenery as a kind of proof of concept).

You have to do this using shaders since the performance impact of hundreds of AI objects will be staggering otherwise.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: AI Cars

Postby Hooray » Wed Mar 18, 2015 2:14 pm

I suggest you take a look at this thread: viewtopic.php?f=5&t=24594&hilit


Like Thorsten said: the AI traffic system would only be useful for low-altitude flights - otherwise, you'd want to use a GLSL/effects-based approach.
Subject: osm2city.py development
radi wrote:Image
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: AI Cars

Postby Pakistan-1 » Wed Mar 18, 2015 3:46 pm

I asked because I want HongKong bussss and cars to be driving around in Hong Kong part of Project Hongkong
User avatar
Pakistan-1
 
Posts: 498
Joined: Tue Jun 18, 2013 3:49 am
Location: Hong Kong
Callsign: DocDMG,PK1,MIA2020
Version: 3.7
OS: Windows 10

Re: AI Cars

Postby Hooray » Wed Mar 18, 2015 4:24 pm

First of all, you'd need vector data for the corresponding road networks - next, you'd use those to come up with heuristics for creating and controlling "traffic". Usually (at high altitudes), those will just be colored spots moving along your roads - at lower altitudes (take/approach), you'd want to use some kind of LOD mechanism to use animated AI traffic nodes, at least within the visible FOV.

Recently, the AI system has been modified to use PagedLOD - I am not sure if/how this could make use of effects/shaders - but that would be the best option, i.e. using a simple LOD mechanism to use effects/shaders, and only use AI models if absolutely necessary - but I am not the right guy to talk about what's possible on the effects/shader side - but I am sure Thorsten can fill us in on what's technically possible/missing or what kind of workarounds might work.

Personally, I am thinking along the lines of using a simple placeholder 3D model - possibly invisible/transparent, and using that to leverage effects/shaders. Internally, this could then be used for a simple LOD structure that would only actually show a 3D model (and animate it) within a certain range from the viewer/camera.

Regarding vector data, the easiest way would be using an external traffic simulator and using that to create traffic inside fgfs (e.g. using the mp traffic system, but the underlying elevation data may not match obviously, so may require some patching ...) - for details, I'd suggest to search for "sumo" or "vamos" on the forum - for example, see:

Subject: realistic urban car traffic? (sumo+vamos fdm+AI)

miercovich wrote:Hello !
I am interested in educational use of flightgear for an academic project. Part of this will require a richer scenery with urban traffic.

After having looked at the documentation, I understand there is a multiplayer feature in flightgear, as well as generic protocol system for creating custom network protocols, is that true?
Can these systems be used to drive AI ground traffic (cars) on flightgear scenery roads using a network protocol?

If this is not currently possible, would it be possible to create such a custom protocol for doing just that? I am thinking in terms of just GPS coordinates for a number of cars, that get updated at a rate of about 0.1-2 hz, depending on the viewer distance (high priority at low altitudes with high visibility).

I also understand that there is a patch available for flightgear to support the vamos automotive simulator as the fdm: http://www.mail-archive.com/flightgear- ... 22899.html
Image

Then, there is the open source sumo project for simulating urban traffic. Sumo can simulate random urban traffic patterns and uses shape files for moving traffic along real existing roads, in addition it is possible to replay actual recorded real life traffic data. So this would be a great way for populating the scenery.
Image

My question is: Can these features together be used to drive realistic AI road traffic in flightgear from another application (sumo)?
I don't just mean a single AI car, but posssibly hundreds at once to create the impression of realistic traffic driving through the scenery. Like I mentioned, sumo can provide all the traffic information. Flightgear would just need a way to turn the traffic information (positions) into AI objects and move/animate the cars accordingly (using the vamos fdm).

If this is currently not yet possible, what changes would be necessary to support this feature? Could this be added with some scripting, or would we need to look into the C++ source code?
And is anybody working on this or also interested in this idea? What would be the most appropriate (or recommended) route to go about implementing this?

In programmer terms, the following 3 questions are most interesting at the moment:
- can AI traffic be created and controlled using a network protocol?
- can flightgear be used (or made) to accept a sumo feed (positions of car objects)?
- and can these positions then be used to to tell the vamos fdm to move the AI cars realistically?

Thank you very much

- miercovich


Overall, this is touching on the whole "autogen" effort - so there are definitely people interested, willing and able, to help with this.
Personally, I am most likely to help with the AI/Nasal side of this - possibly by using Red Leader's new framework - maybe in conjunction with an I/O protocol to support external traffic feeds.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: AI Cars

Postby psadro_gm » Fri Mar 20, 2015 12:13 pm

Current scenery roads are not very 'connected'. We use raw OSM ways and just plop each one down as a polygon. I am currently working on better algorithms to create more of a network for line data. Right now, I only have this for airport taxiway lines, but will get it into roads as well.

This started as a request for better handling of textured lines, as intersecting lines look awful, even with proper uv coordinates. one line is always 'on top' of the other. They don't really look like they intersect. If we want to be able to create a shader for adding moving traffic / lights, then a continuous network is a must.
8.50 airport parser, textured roads and streams...
psadro_gm
 
Posts: 751
Joined: Thu Aug 25, 2011 3:23 am
Location: Atlanta, GA USA
IRC name: psadro_*
Version: git
OS: Fedora 21

Re: AI Cars

Postby legoboyvdlp » Fri Mar 20, 2015 12:45 pm

Why not a proper texture that looks like a road? You know, black and white lines and grey footpath?...
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: AI Cars

Postby ludomotico » Fri Mar 20, 2015 2:06 pm

Textured roads are already possible, but the official scenery was not built with this feature.

You can use textured roads in custom sceneries.

Image

Notice also "the intersection issue" described by psadro_gm
Last edited by ludomotico on Fri Mar 20, 2015 2:24 pm, edited 1 time in total.
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: AI Cars

Postby Thorsten » Fri Mar 20, 2015 2:15 pm

Why not a proper texture that looks like a road? You know, black and white lines and grey footpath?...


Because you need to align the uv-mapping of the road with its direction, a feature that we don't need for any terrain. Which is why this needs some extra action.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: AI Cars

Postby Hooray » Fri Mar 20, 2015 5:29 pm

right, feeding external traffic into FG would not necessarily be very difficult - but it would almost certainly never match "roads" shown in FlightGear, and even if elevations would be patched up, there would remain quite a bit of work to be done.

http://www.dlr.de/ts/en/desktopdefault. ... ead-41000/


These external tools will usually need vector data (think ESRI shape files or OSM data) to create traffic.
http://veins.car2x.org/
Image

So if you're looking for something that will look "plausible" right now, it will probably involve poweroftwo's osgEarth branch:
Image

Otherwise, you will inevitably need a way to disable existing road networks entirely and load your own networks, i.e. using existing vector data and some way to texture roads dynamically - possibly involving effects/shaders and a tiny bit of Nasal/Canvas to create a cached texture map with different road elements that are placed on demand - which isn't necessarily too difficult, we are already drawing runways and taxiways procedurally:
Image

However, actually using such a Canvas-based texture will involve patching C++ code in SimGear to drape sub-textures over the terrain mesh accordingly - there's proof-of-concept code demonstrating how this can be done, see: http://wiki.flightgear.org/Photoscenery ... otoscenery
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: AI Cars

Postby Pakistan-1 » Wed May 06, 2015 3:32 am

Could somebody here help me add them please
User avatar
Pakistan-1
 
Posts: 498
Joined: Tue Jun 18, 2013 3:49 am
Location: Hong Kong
Callsign: DocDMG,PK1,MIA2020
Version: 3.7
OS: Windows 10

Re: AI Cars

Postby Hooray » Wed May 06, 2015 1:42 pm

you need to be more specific - have you actually looked at any of the pointers/techniques suggested- and if so, what approach do you prefer ?
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: AI Cars

Postby Pakistan-1 » Thu May 07, 2015 3:10 am

Im confused
Which would be the best way ?
User avatar
Pakistan-1
 
Posts: 498
Joined: Tue Jun 18, 2013 3:49 am
Location: Hong Kong
Callsign: DocDMG,PK1,MIA2020
Version: 3.7
OS: Windows 10

Re: AI Cars

Postby Hooray » Thu May 07, 2015 9:17 pm

that depends on your goals, requirements and skills/time frame.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to AI Traffic

Who is online

Users browsing this forum: No registered users and 1 guest