balidani Posted May 6, 2020 Posted May 6, 2020 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
balidani Posted May 14, 2020 Author Posted May 14, 2020 I made some progress! The generated coasters always get stuck somewhere though, so more work is needed. 1
jensj12 Posted May 14, 2020 Posted May 14, 2020 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.
balidani Posted May 14, 2020 Author Posted May 14, 2020 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.
jensj12 Posted May 14, 2020 Posted May 14, 2020 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.
balidani Posted May 21, 2020 Author Posted May 21, 2020 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: That's it for now, I'll generate more interesting coasters when I have a better model Cheers! 1
jensj12 Posted May 21, 2020 Posted May 21, 2020 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.)
balidani Posted June 1, 2020 Author Posted June 1, 2020 Sorry for the late reply, I had to go through some steps at work before sharing my code. I posted everything here, along with a short description of what everything is: https://github.com/balidani/coaster_generator Hope you don't find it too ugly 1
jensj12 Posted June 2, 2020 Posted June 2, 2020 Thanks! No worries about the delay, it will take a few more weeks anyways before I have some spare time on my hands. 1
CoasterGeneratorer Posted June 4, 2020 Posted June 4, 2020 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?
X7123M3-256 Posted June 4, 2020 Posted June 4, 2020 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.
CoasterGeneratorer Posted June 4, 2020 Posted June 4, 2020 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.
jensj12 Posted June 5, 2020 Posted June 5, 2020 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now