Page 1 of 1

C++ Finale - Traffic game

Posted: June 13th, 2019, 9:00 am
by noU69
Hello world!
So, yesterday I took my last exam so now I finally have some damn time to code instead of memorize useless shit to pass. But this summer I got selected for a C# internship which starts in like 2 weeks.
Before that , I want to make a really cool game that will sum up all my knowledge gained over time, kinda like a grand finale.
My idea is: (obviously not original but that s not the point)
A straight line traffic game(sort of a frogger), but with traffic from time to time(I ll attach a photo to explain it), and your goal is not to get hit. The player is a car and has to avoid other cars. Also, I would like to make the game infinite, and it to not be predictible.

So my question is: How can I make the game to generate itself infinitely? I can't find anything but I m sure here I'll find some good answers.
I attached a photo below, thanks for reading *this(haha )
Untitled.png
(44.21 KiB) Not downloaded yet

Re: C++ Finale - Traffic game

Posted: June 16th, 2019, 3:14 pm
by chili
you could represent the game data basically as a std::deque, adding enough so that you can render a new full screen with data to spare. As you move right, you add new level data to the front, and remove from the end. It would be pretty easy for a game that only progresses left-right. full 2d would be trickier, but still very doable.

Re: C++ Finale - Traffic game

Posted: June 18th, 2019, 4:06 am
by albinopapa
My thought was to wrap the city blocks around as they would be the same, each north/south street would be a vector of automobiles that are randomly generated. As one north/south street leaves the right edge, move ( std::move ) each later vector to the previous vectors, then in the last one start spawning new automobiles.

Chili's method though does have some advantages. One, each block and street configuration could be different, such as buildings and number of lanes. Technically the advantage would be releasing one screens worth of data each time instead of 5+ vectors in my scenario.