All entries for January 2006

January 28, 2006

Now then

OK got as far as basic AI to drive forwards and not crash into cars infront.

Problems so far:

Lane changing

Complicated to move vehicles from one lane to another in the linkedlists (threads + itterators = evil). Now just realised that i get problems when cars change into a lane with no cars behind them, or into a lane with no cars infrot of them, i.e. can only move if between two cars. Great.

January 08, 2006

After Xmas Update

Finally got around to coding now, heres the final hirachy:

Main program divided into 3 subsections:
GUI (main gui and action handlers)
Engine (main runfile, manages everything)

The Entities are related by:

JEntity (basic knowldge of position/lane, abstract methods for tick/draw)
JVehicle Other Ents (Divided into general/info markers/static road etc).


All ents must
Tick() – called by engine to upadate ent
Draw() – called by GUI to engine to ent to draw the object (if drawn).


Development so far:

  • Basic GUI to display vehicles
  • Basic vehicle place holder ents which just move forwards
  • Entities such as
  • Info ents – placeholders in place, a class to pass information from them to the ents has been created
    1. Road ents – a 'peice' of road for the cars to drive down. Each 800 units long. Divided into 4 200 unit subsections where ents can be placed. Onramp placeholder made. Handles kill car ents
    2. Spawns for cars (needs work to add variation)
    3. Kill Car entities

    Logic so far:

    1. Engine timer called. Loop through all entities in list and Tick(). Loop through all Vehicles and Tick().
    2. Entities Tick() – do what is needed. May be generate a new Vehicle etc (or nothing)
    3. Vehicles Tick() – first check where we are. If we have entered a new 200 unit subsection then check if there are any new info ents to know about (speed limits/headway markers etc). Then we call Move(). If we find a CarKill then tell the engine we have.
    4. Engine – see how many cars have to be Killed. Pop from appropriate ques.
    5. Engine Draw Timer. Loop through all ents and vehicles and call Draw().


    How to Manage entities within the engine
    When a new entity is created, the constructor within JEntity adds it to the engines know entities. Cars are added to a queue (there are three queues, one for each lane, when a kill signal comes it pops the queue). Entities are added to a linked list, organised by position. NEED WORK If an entity is moved its position in list needs updating! Change list to an array and just search? Speed if each car keeps searching?

    Drawing Ents
    Needed to add a second timer to call Draw() seperatly or else when moving/resizing window timing dies.

    What to do now

    1. Add ability to add entities by clicking on GUI. Shouldnt be too hard (current structure makes it v. easy to add ents, just need basic code and dias to manage ents)
    2. Physics
    3. Develop Road Entity to auto generate entities
    4. Develop car spawns – need to ability to increase/decrase flow over time
    5. Ramps?!

    January 2006

    Mo Tu We Th Fr Sa Su
    Dec |  Today  | Feb
    2 3 4 5 6 7 8
    9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29
    30 31               

    Search this blog

    Most recent comments

    • You might want to add which class has the main method in it, or compile it as a jar file, otherwise … by Matthew Jones on this entry
    • Ok, it's actually one. If it's not the same as the one at home then you need to make sure they match… by on this entry
    • That's two hyphens. by on this entry
    • java version by on this entry
    • worked at home on windows by on this entry

    Blog archive

    Not signed in
    Sign in

    Powered by BlogBuilder
    © MMXXI