The Daily Click ::. Forums ::. Klik Coding Help ::. Traffic Engines, come on you smarites!
 

Post Reply  Post Oekaki 
 

Posted By Message

Mr Coffee



Registered
  04/09/2003
Points
  440
18th January, 2004 at 14:09:53 -

First of all, it does not look messy if you make the detectors invisible. Second, having duplicates of the same object does not use up more RAM. And finally third, detectors are only going to slow it down a little more (because you have to use them to detect collisions). Most people today have at least a 1 ghz, so your not going to notice a speed difference between using an array and using detectors except on a slow computer. But if you think arrays are easier to deal with then use them. Everyone should use the method thats easiest for them, especially if the end result is the same.

 
99 percent chance that the above post is 100 percent correct.

cake



Registered
  13/12/2002
Points
  1173
19th January, 2004 at 06:26:05 -

Lew knows what I'm on about and I know what you're on about Lew. I don't think you should bother anymore, right now I'm kind of lost for words as to how incorrect Mr Coffee is "duplicates don't use more RAM", um actually yes they do.
But anyway, the system Lew described is the most efficient, maintainable, managable, debuggable, and powerful system to use.
Detectors = quick fix
Database of cars and intersections = a very powerful system that can be used for many different purposes, manouvering traffic is just one of them.

Theres an important issue this little quarrel has brought up with coding:
make your code as usable as possible. What else can I do with detectors stuck all over the place? Not too much without recoding considerable portions of preexisting code. Make tools with your code, not end products. Make things you can reuse over and over for many purposes.

Image Edited by the Author.

 
n/a

Mr Coffee



Registered
  04/09/2003
Points
  440
19th January, 2004 at 13:49:16 -

Well, I said "duplicates don't use more RAM" and that was incorrect (now I have to change my signature!). I just did some tests and they *do* use more RAM, although the amount is extremely small (50 duplicates of a small object will use up 1 more meg of RAM). Also, I would like to point out that I don't think you should stick detectors all over the road, and I never did. I think thats why you say its "messy". The cars should adapt to the road themselves. However, the easiest way to go about this is to have 4 detectors linked to each car, so it has a 360 degree view of the road and other cars. The car must know whats on all sides of it, so it can react correctly. I am not talking about a "Sim City" style traffic simulation where the cars move on a grid. My idea of a traffic simulation is more down to earth, where the cars have physics and have to react to the road and other cars.

For example, you could have SUV's which take longer to stop, so you simply place the SUV's forward looking detector farther ahead so it applies the breaks sooner when the car in front stops. This would make a great screen saver, and I will probably make it one of these days. The only thing I don't have figured out is how to deal with parking lots.

 
99 percent chance that the above post is 100 percent correct.

cake



Registered
  13/12/2002
Points
  1173
19th January, 2004 at 19:31:26 -

But having a database DOES give the car a 360 degree view. And you can variate the distances that the car checks around it so you can still have your SUV idea.
I think that you are looking at this at a car-to-car level, but I'm looking at the big picture, I'm looking at it at a city level.
There is a possibility that detectors would work ok, but its only an immediate solution, its only the quick fix, it's only solving the immediate problem that Andy is having, whereas the database solves this problem, and many other possible problems down the track.

Just use some simple coordinate comparison, and distance formula and you're laughing all the way to the advanced traffic simulation. Look at it this way: GTA didn't use detectors: GTA used coordinates and mass data. "Detectors" are the baby MMF way of getting around doing proper mathematical coding and referncing. Outside MMF detectors don't exist- they are just way too inefficient and wasteful.

 
n/a

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
20th January, 2004 at 04:01:17 -

They're still there in most platform games... but that doesn't matter... this sounds like the start of another debate, we should let Andy decide which method he'd rather use, it's his game after all

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

cake



Registered
  13/12/2002
Points
  1173
20th January, 2004 at 05:10:54 -

True, its up to Andy. I just really want to see him make it without any troubles

 
n/a

Mr Coffee



Registered
  04/09/2003
Points
  440
23rd January, 2004 at 19:09:46 -

I don't see why using detectors is "less expandable". I have never said the detector method is more efficient, using an array is of course more efficient. But everything is a trade off between how long it takes to program verses how much it effects the game. The user will not be able to tell if you use detectors or not. If you spend to much time coding complex things you won't get anything done. If Andy does not mind using an array then fine. I just would not do it that way, because I actually want to finish something.

 
99 percent chance that the above post is 100 percent correct.

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
25th January, 2004 at 18:59:58 -

Wow, i go on holidays for a while and everyone posts. Thanx for all the help guys. I see that many of you seem to think that the easiest method would be using detectors at T junctions. But that is not the case because you have to remember that a road has two sides, and two directions.

Biax had a great idea, that was the method that I was going to use on the pedestrians to test if they were overlapping the road or not, but I didn't really think about it for the cars so maybe I can do that. Sadly Yuyu is leaving in a few days and we won't see any great click games by him for a while. But I will continue this project at a steady pace and maybe you will hear from it in a few months.

If you are interested in this project or would like to contribute any feedback, please don't hesitate to email me at andy_likes_chicken@hotmail.com

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
   

Post Reply



 



Advertisement

Worth A Click