Jump to content

Auto-generating coasters.


Recommended Posts

Posted

Hello!

A long time ago I have seen a talk about somebody attempting to auto-generate coasters for RCT using genetic programming: https://www.youtube.com/watch?v=KUBYTcVjp7I

The talk is interesting but unfortunately the results were not very impressive. I was thinking about doing something similar either using SMT solvers or using a regular dynamic programming approach. 

I have 2 quick questions:

- Does anyone here know about any more research on this topic?

- Does anyone know what would be the easiest way to data mine all track pieces (ie. for steel coasters) and their boundaries, the clearances needed, etc.? I started working them out by hand but they are not intuitive, for example it's hard to say how the height increases on large inclined curves.

Thanks,

Daniel

 

Posted

Whoa, if you did not disable clearance check for the generator to get that to work, awesome job! I wouldn't expect it to be possible to create such a cluttered mess with a generator.

Posted

Yeah, I did not cheat :)

I do need to run many iterations before stumbling on something that can get back to the station. It's a very simple backtracking approach so if it starts out wrong it can get stuck. I am planning on creating something more sophisticated but first I want to make sure the generated coaster is valid, in that it can actually do a full lap.

Posted

If it’s just backtracking forward, there are options that should work. Keep track of the expected speed (or maximum reachable height) and you can forbid pieces that violate these additional height restrictions. Should make it possible to add banked turns on high speed corners as well. If you need some ideas or validation of your own, I’m ready to help as this project looks really promising.

Posted

Hello!

Thanks for the suggestions, jensj12! I did a very simple attempt at restricting height as the track grows. It kinda sorta works, but I'll have to think about a more accurate model. The nuclear option would be to take OpenRCT2's code that actually simulates the coaster across the track and measure everything. But the code seems complicated enough, and with the current bruteforce-like approach I'm sure it would be super slow.

In the meantime I converted my Python code to C++ so everything happens in a single step, producing a td6 file that I can test.

I created a large coaster that can do a full lap with some cheating (I changed some flat pieces to boosters). Here is what it looks like. You can see that I also added loops.

Then I added banked turns. To try and get better stats I removed any non-banked turns for now. There are some issues with this, one of them is that I don't restrict banking and sometimes the track wobbles from left to right and back. I'll have to add another state machine that dictates which states are legal, so that once it banks in one direction it commits for at least a few track pieces or until a turn is made, etc.

I generated some super tiny 14x6 coasters, the stats are surprisingly not that bad:

coaster2.thumb.png.95b8c768e6dfa417fa722dd181e25758.png

That's it for now, I'll generate more interesting coasters when I have a better model :)

Cheers!

 

  • Like 1
Posted

Glad to see this working out nicely. I'd like to help with the formula's, but since that's rather trail and error, that might be easier if I somehow got a copy of the code. (If you're willing to share it but not publicly, my GitHub name is the same as here.)

  • 2 weeks later...
Posted
On 14/05/2020 at 06:37, balidani said:

Yeah, I did not cheat :)

I do need to run many iterations before stumbling on something that can get back to the station. It's a very simple backtracking approach so if it starts out wrong it can get stuck. I am planning on creating something more sophisticated but first I want to make sure the generated coaster is valid, in that it can actually do a full lap.

I tried to approach this problem about 3-4 years ago but I could not figure out how to automate the scoring of the ride. Has any progress been made on this front, or does it still require manually opening the game and making the coaster to get the statistics (nausea etc) for the guests?

Posted
27 minutes ago, CoasterGeneratorer said:

I tried to approach this problem about 3-4 years ago but I could not figure out how to automate the scoring of the ride. Has any progress been made on this front, or does it still require manually opening the game and making the coaster to get the statistics (nausea etc) for the guests?

You could try to extract the relevant code from OpenRCT2 but it's going to be quite complicated - in order to calculate the ratings you need the stats, and to get those you have to run the entire physics simulation. A better idea might be to try to implement the coaster generator within OpenRCT2 itself as a plugin - or use some kind of heuristic.

Posted
3 minutes ago, X7123M3-256 said:

You could try to extract the relevant code from OpenRCT2 but it's going to be quite complicated - in order to calculate the ratings you need the stats, and to get those you have to run the entire physics simulation. A better idea might be to try to implement the coaster generator within OpenRCT2 itself as a plugin - or use some kind of heuristic.

Which file(s) contain the physics simulation code?

My goal is to run the physics simulation outside of the game without any of the graphics or auxiliary game mechanics slowing down the simulation. And if I can understand how Chris went about simulating friction, gravity, etc on the roller coaster, then I can hopefully emulate and possibly accelerate the simulation outside of the game.

Posted

The drawing and simulation code are already separated. If you just use a (small) park with a single coaster and don’t use any drawing code, it will already be very fast. Balidani already uses some of the game code directly in his algorithm, you can take a look for some inspiration. The simulation code should be easy to find if you just dive into the main loop of the game, but be warned that it may be very large.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...