Your the selection of placed obstacles seem to take their predecessors into account, like no double police cars in sequence on the same lane, or in general the increasing frequency of lane changes. I'd like to know how the obstacle placement is controlled to create increasing difficulty but also avoid repetition (if it does).
I can think of ways to query these things, but i was wondering if you had a particular setup to handle it efficiently?
Ah yes I see. This was probably the biggest challenge to overcome - to make sure that there was always a path for the racer to pass whatever the difficulty. This may be quite difficult to explain without sharing the capx. I'm afraid I only really used a brute force technique, covering all spawning situations (e.g. if a police car is in the left lane, only spawn cars in the right lane, so there is still a path for the motorbike to pass in the middle.) The basic setup of the spawning is documented below.
Overall, as the time went on there was not too much increasing of the frequency of lane changes, apart from a few more challenging (e.g. roadblocks including tanks) obstacle sets being introduced as your score increases. Disregarding this small contributor, the only reason why the game gets more difficult is really due to the increase in the motorbike's speed.
All of the obstacles spawning is done with timers. Every (10 x (1 / motorbike speed)) seconds, the game attempts to spawn a car in a random lane. Then, every X seconds, the game attempts to spawn a roadblock or a police car. This is also done in a random lane in a random combination. The game does not detect if there has been repetition or anything like that, it just uses a random timer and then a lot of if conditions to ensure the cars appear randomly yet still allowing a way through.
For the most complicated of combinations, I simply laid it out exactly how I wanted it to appear:
This is only a small snapshot of the code (>1500 lines in total!), so it will still be difficult to understand.
Please ask if you need help with this knowledge drop!