Jump to content
  • Advertisement
Sign in to follow this  
tiagomagalhaes

[Java] Road Traffic Management Project

This topic is 3408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello... first of all i want to say that website is a good one for those that want to develop games and maybe in the future i would visit this page for develop a game... In my University, I'm starting to learn java, and in my first project i have to create a road traffic management without a graphic Interface... and to start, i think that is important to start with the terrain. But the terrain must be implemented with hexagonal tiles... and i don't know how to implement it because the terrain will have cities and roads, and i dont know how to store that information... i thought in: - bi-dimensional arrays - Hash Maps can anyone help me please??? i would be very appreciated I have to get this done before the 3rd of May thanks...

Share this post


Link to post
Share on other sites
Advertisement
As a first guess, I'd start with a class representing a terrain cell. The class would have six members of its own type (one referencing every adjacent cell, with null meaning no cell is adjacent in that direction), plus any other info you care to put in it.


public class Cell {
private Cell northwest, north, northeast, southeast, southwest, south;
}

Share this post


Link to post
Share on other sites
Quote:
Original post by lightbringer
As a first guess, I'd start with a class representing a terrain cell. The class would have six members of its own type (one referencing every adjacent cell, with null meaning no cell is adjacent in that direction), plus any other info you care to put in it.

*** Source Snippet Removed ***


and this would have 6 fields right?

Share this post


Link to post
Share on other sites
Well, hexagons had six sides last time I checked, so yeah. My approach is probably more than a bit naive and not really suitable for drawing - you could do this with a 2d array somehow, like you mentioned, by shifting every other row when drawing it - but you said that you are not gonna draw anything to screen anyway, so treating each tile as a kind of "room" seemed most intuitive to me.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!