Home › Forums › Programming › Help about random city generating in C++
- This topic has 6 replies, 6 voices, and was last updated 17 years, 6 months ago by
Anonymous.
-
AuthorPosts
-
-
November 25, 2005 at 12:10 pm #4822
Anonymous
InactiveHello. I must tu generate random city maps in c++. I think to use a 2 dimensional matrix. According to the values in matrix I will draw the buildings,ways and cars,taxis,motobiycles etc on ways. How can I do these? Can you help me??? :?:
-
November 25, 2005 at 1:09 pm #27671
Anonymous
InactiveSorry, took a wrong step and now I’m on the programming boards……..must go and have a shower now to cleanse myself!
As to your problem, I’m sure someone around here has an idea of what you need……but I’m an artist, and talk of Matrices confuses me greatly! ;)
-
November 25, 2005 at 1:45 pm #27672
Anonymous
InactiveHello. I must tu generate random city maps in c++. I think to use a 2 dimensional matrix. According to the values in matrix I will draw the buildings,ways and cars,taxis,motobiycles etc on ways. How can I do these? Can you help me??? :?:[/quote:33d4e10d87]
have you not answered your question?
have something like the following:
in your setup do the following once:
int cityArray[5][5];
srand(timeGetTime());
const int CAR=1;
const int BUILDING=2;
const int TAXI =3;const int NUMBER_OF_ITEMS = 3;
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
cityArray = rand()/%NUMBER_OF_ITEMS;
}
}then during rendering do the following.
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
switch(cityArray)
{
case CAR:
{
renderCar();
break;
}case TAXI:
{
renderTaxi();
break;
}
case BUILDING:
{
renderBuilding();
break;
}
}}
}finally if you wanted to make this better, the array could be an array of structures(instead of int’s) which have stuff in them like x,y coordinates,textures etc.
Alternatively if your going the c++ way then you might make them class and create a polymorphic array where each different object type has an override render which gets called. If you arent familar with these terms then read up on them before you write your game.. these technqiues will save you an ass load of timepeter
-
November 25, 2005 at 2:27 pm #27673
Anonymous
InactiveWell you could start by looking at this:
In particular check out what these guys have done:
http://www.centralpictures.com/ce/tp/paper.pdf
And then maybe in about a year’s time you could check the link below when hopefully there will be results available on the research project we are just starting on this exact topic …
http://www.gamesitb.com/index.php?option=com_content&task=view&id=21&Itemid=28
Alternatively if you are looking to lash up something quickly then do what Peter said …
-
November 25, 2005 at 4:10 pm #27690
Anonymous
InactiveAs to your problem, I’m sure someone around here has an idea of what you need……but I’m an artist, and talk of Matrices confuses me greatly! ;)[/quote:66b66bdb52]
Don’t worry mate, there is no spoon
-
November 25, 2005 at 4:29 pm #27693
Anonymous
InactiveThen what did I just use to eat this bowl of ice cream then??……..unless……
-
November 25, 2005 at 4:45 pm #27694
Anonymous
InactiveToo many pills :(
-
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.