Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
ShellfishGames
11
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 8th Dec 2014 17:45
Hey guys,

as part of my Ludum Dare game Frostbite (will probably post it on here somewhere as soon as the post compo version with all the bug fixes and improvements is done) I also created a rollercoaster. For the end credits of the game, sort of. Doesn't really make much sense as the game has nothing to do with rollercoasters, but I really wanted to take the chance... Especially given that this is probably my first and last 3D project in a long while.



I haven't seen anything like this made with DBP before (well, maybe I just missed it), so I thought I'd share it.
As it wasn't really an essential part of the game it's certainly far from perfect - no support structures, no train (the camera simply moves along the track), no scenery (just this voxel environment that makes your eyes hurt), the ride itself doesn't really flow all that well (those splines are hard to control man!), the texturing is rather suboptimal, the coaster doesn't make any sound.. but still, it's kind of cool. And considering I just spent about a few hours on it from the first thought of "hey how about a roller coaster?!" until it was readily implemented in the game (also given I have basically zero experience with 3D stuff), it turned out way better than I expected.





Few notes on the technical background:

* Coaster was built in a small, self written editor by placing nodes - each node has a position and orientation and the're usually like 10-20 meters apart
* For every node, 32 "steps" are precomputed (every fourth or so is used to create these horizontal bars supporting the rails) using a spline going through the nodes
* Movement between two adjacent steps is interpolated in a linear way
* When the coaster is built, a simple algorithm maps spacial progress to the coaster's "progress parameter" (indicating where on the track the coaster is in the node domain.. i.e. a value between 1.0 and 2.0 means it's somewhere between node 1 and 2).. this is required to make sure the coaster's speed affects the actually travelled distance and not that arbitrary progress parameter (otherwise it would move much faster the further two nodes are away, which isn't realistic and significantly impairs the experience)
* When riding the coaster, it's accelerated by gravity by multiplying some constant factor with sin(ax#), where ax# is the x angle of the coaster at that point, additionally a bit of friction slows the coaster down over time
* As I wasn't satisfied with the output, I ran a simple blur function over all the coaster's steps several times, this made the whole ride (at least the camera behaviour - the visual appearance of the coaster itself didn't change) much smoother and more enjoyable
*I actually wanted to have a proper inversion in the track, but as soon as I made it more vertical than the one there is now, I ran into angle problems. The camera would always make a very quick 180° turn and end up on the wrong side of the track. Couldn't figure out how to solve that yet, hence the track is rather flat and simplistic.


I might be going to improve this a bit in the future, or use the code to create a proper coaster in a more natural environment, i.e. on a terrain, with trees and water and skybox and stuff - just for the sake of it. But that would take time, and I don't have a lot of that.

If you want to try the coaster yourself (although that doesn't make much of a difference since you can't move the camera during the ride), feel free to download the game. Might take 15ish minutes to get to the end, but I like to think the rest of the game is also worth the time.



tiffer
17
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th Dec 2014 19:47
Rather fun idea. Must have taken a while?
ShellfishGames
11
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 9th Dec 2014 00:34
Well, I think it was about 5 or 6 hours all things considered. Which I still find somewhat astounding to be honest, but magical things happen during those 48h contests.

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 9th Dec 2014 01:43
Nice!!

Since you have all the algorithms and whatnot sorted out, with a bit of additional modeling you could make one of those roller coaster building games, or even something more original.

ShellfishGames
11
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 9th Dec 2014 02:12
Hehe, yes indeed. I already thought about adding scripting to the package to define any desired coaster behaviour. Would be neat...
But then again, the way it is the spline system isn't really working great. It was quite a struggle to get the track done in a way that doesn't seem weird. So editing coasters right now just isn't very fun or intuitive.

Also "a bit of additional modeling" is huge for me. In the Ludum Dare game, everything is created within the code using plains and boxes.

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 12th Dec 2014 12:41 Edited at: 12th Dec 2014 12:45
Quote: "Also "a bit of additional modeling" is huge for me. In the Ludum Dare game, everything is created within the code using plains and boxes."


LoL... does this mean you hate modeling, or you just avoid anything with rounded edges?

Oh wait, I see what you're saying... but I was thinking about this as a totally separate game from this one.

ShellfishGames
11
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 12th Dec 2014 13:08
I just wouldn't know where to start. Played around with Cinema4D in the past.. many years ago, but even the simplest objects turned out to look ridiculous. I think it's just not one of my talents.
On top of that, I have not the slightest idea how you would texture a 3D object. So I guess figuring that all out and getting to reasonable results would require way more time and effort on my part than all the programming. Which is why I just try to avoid it alltogether.

ShellfishGames
11
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 18th Dec 2014 00:59
Well, OK, I started working on a proper terrain coaster. Still a lot of work ahead, but I made some surprising progress regarding the lack of flow mentioned before - there was a "bug" due to some node step interpolation I forgot I was doing which messed up the distance based acceleration. Got it sorted out now, so you're actually driving along the track pretty smoothly and really feel the speed.

Loops still don't work, but twists and corkscrews do (as the screenshot below demonstrates rather clearly). Also I switched from pure node based track building to a more Rollercoaster Tycoon like approach where nodes are based on predefined track pieces, each of which can be scaled uniformly as well as altered afterwards. However, I'm still hardcoding the track within the code as of now as I didn't get around implementing proper editing yet. Also there are lift hills now, so the "train" (or rather the camera) gets pulled up at a constant speed which allows to reach greater heights and consequently allows greater drops.



Stuff that remains to be done:
-textures
-add water to terrain
-sound
-proper track layout
-possibly some kind of wagon beneath the camera
-lense flare

Cheers.

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 18th Dec 2014 11:17
Cool

BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Dec 2014 18:22 Edited at: 18th Dec 2014 18:23
I like it. I played with this concept a while ago, with roads rather than rails. I'd love to get back to it and take it further. My final version involved "dropping" the road onto a terrain in order to create the final moulding. It might something you could add to your library to create some more exotic track pieces.



Quidquid latine dictum sit, altum sonatur
The Tall Man
10
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 18th Dec 2014 19:35
nice!

Judging what we see is the greatest blinder and self-limiter in the universe.

What we perceive is never reality. It is only a story we tell ourselves based on our current perspective, which has far more to do with our beliefs about ourselves than with anything else.
ShellfishGames
11
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 20th Dec 2014 01:39
Pretty cool BatVink! I guess that would be the perfect solution for an alpine coaster kind of layout, I'll see when I get time to implement it.

Login to post a reply

Server time is: 2024-03-28 20:48:25
Your offset time is: 2024-03-28 20:48:25