I am thinking to develop a program/software to simulate autonomous driving car (artificial intelligent agent) using java. A car(agent) will move forward avoiding the obstacle in the dynamic environment. How do i start?

are we talking virtual, or an actual "car" that you'll be driving around in your living room or something like that?
if it's the second, don't go for Java. go for a language that 'll be able to completely interact with the hardware to go with it

Unless you are going for an engine, cool graphics and things, wouldn't that be similiar to a maze solver? If so, you can start from there

@ stultuske: I am talking about a virtual "car" with traffic(other cars or vehicles from opposite direction as obstacle).

@ stultuske: like computer controlled cars in racing games.

in that case, Slavi is right.
it's a bit like a maze solver, just check the front of the car with what's in front of it, and what's beside that.
if there's something in front of it, turn (after checking which way).

but, indeed, for your start, all you need is a maze solver, with situations where you can go only either left, or right. (nowhere you can turn both).

it'll be easiest to program, you can re-use the same algorithm everywhere:

while not finished
  if front blocked 
    if right blocked
      turn left
    else
      turn right
  end-if
  move forward
end-while

in the next step, you go for a maze, where there are turns where you can choose to go either right or left.

next: implement something like:

if front blocked
  if left-from-front blocked
    if right-from-front blocked
      stop car
    end-if
    pass-obstacle-right
  else
    if right-from-front blocked
      pass-obstacle-left
    else
      pass-obstacle-right
    end-if
  end-if
end-if

@ Slavi: There will be simple graphics to represent the cars and the paths. The car will follow the path(track) avoiding the collision with the cars coming from opposte driection. If the track is blocked by traffic then the call will stop until the track is free. I am a beginner in java. So can you please give me some idea on how to start the mentioned things.

@ stultuske:thanks... i'll try to implement your algorithm.

I think stultuske's algorithm will give you a basic behaviour to satisfy your idea, perhaps you need a finish line or something as well? The algorithm won't be anything to worry about, its something really basic and will take no time to do, if you get stucked you can always ask in here for help. I think you'll have to spend quite some time though looking into game engines and desgining the cars (I assume you'd want them different models BWM,Mercedes :D etc ) I'd probably make the graphics first and then start the coding. Also, to begin with, go for 2D game I guess and have only 1 track to reduce the complexity. Wish I could point you to a game engine but I really can't remember what I used

start very simple, 2D. your 'obstacles' will have coördinates, so will your car. just to get the hang of it, start with the most basic 2D version you can think of, just to get the hang of programming towards detectin 'near collisions'.
3D 'll be a lot more difficult to implement, that, I would not recommend trying to write from scratch. and, in the end, as the original Grand Theft Auto games 've shown us: crashing up frontal with a car in 2D (looking on top of the car) can be just as fun :)

state machine, collision detection/avoidance algorithms, simple pathfinding algorithm. Don't think you need much more (but you'll have your hands full on those).

jwenting, of course there 'll be need for (a lot) more to get a complete application the way he wants it to, but it's as good a place to start as any.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.