Saturday, 12 April 2014

Welcome to the 21st century


We are slowly moving to the less visible features, and the feature I am talking about today is one of them (in a sense).

If you're following the news about SDL (our video and keyboard interface), you know that after many many years, a new SDL version has been released (SDL 2.0). One person found that interesting enough to clone our github repository, and modify the program for the new interface. Unfortunately, he left before I had a chance to look at the changes in detail and discuss them.

Another thing that has come up at times is the question of 32bpp colour (aka full colour) support. At the start of the project, we considered 8bpp colours enough (just like the Rollercoaster Tycoon 1 & 2 programs). However, you see an increasing interest in full colour from users. Also, the video hardware is moving away from 8bpp. In other words, eventually, we will need full colour support for the program. Thus, I took this opportunity to add 32bpp support to the program, together with the switch to the new SDL 2.0 library.

At the top-right you see the before and after images. Looks the same, you say? Well, you're right about the grass. In both images it's the same sprite. The shop however is different, as you can see below at 800% zoom. The left part shows the shop as we had it from the start. The right part is the same shop, but in 32bpp. The right image is much smoother at 800%, without the weird coloured pixels here and there.

Technically, the program accepts and renders both 32bpp and 8bpp images. Our current shop sprite isn't a great example of what you can do with full colour support, but I am sure we will get shiny new colourful graphics somewhen.

Sunday, 29 December 2013

Moving coaster cars

Hello all,

If you are watching the YouTube FreeRCTGame channel, you know already, there is a new video.

It shows building of a small roller coaster, followed by a moving coaster car (at fixed speed, and not rotating along with the tracks). For some reason, the blog doesn't allow me to link to the video directly (thank you so much, smart user interface), so instead I post the url: http://www.youtube.com/watch?v=aqBzyJIvrrg I hope you like it.

Saturday, 2 November 2013

Car tracks


After tracks, the next step is obviously to have some cars on them, carrying paying guests of course!
In the real world, you just put the car on the track, and it will follow them. In the digital world of make-believe, car graphics don't care about track graphics, and you have to explicitly tell them how to move through the world.

If you remember the original Rollercoaster Tycoon programs, you'll know tracks came in all kinds of bendy shapes, so how to do that?

One answer that should work (we think), is segmented cubic bezier splines. Basically, you define a start and end point in 3D space, and two intermediate control points (also in 3D), and the bezier algorithm computes a smooth line from the start to the end point. For the more bendy shapes, one such spline is not sufficient, you either need a higher order bezier curve (but it's math becomes complicated), or you chain a number of cubic splines after each other. If you do that careful, the cross-over from the end of one spline to the start of the next spline is also smooth.

So far so good, bezier splines gives a line of rope through 3D space for the car to follow. But what about the orientation of the car? (Keep in mind, the car ignores the track graphics!)

Just a line doesn't tell whether the car is up-right or upside-down (or anything in-between). To solve this problem, a track also needs a roll orientation for every point at the line. A smooth path from a starting roll value to an ending roll value (in degrees).... Another segmented cubic bezier spline to express the roll orientation in degrees!

From the direction of the 3D line (for the mathematically inclined, its derivative) and the roll, the pitch and yaw can be computed (hopefully, I haven't actually tried that yet).

For the test rollercoaster track graphics, roll is simply 0 (upright orientation), so that's easy. The path involved a bit more experimenting. I made a small Python program that plotted the path curve onto the existing track graphics, and tuned the start, end, and control points until it all looked ok. You can see the result above.

For example, the path of the level-to-going-down-track in negative x direction (bottom-right sprite) is defined  as

car_xpos: splines { cubic { a: 255; b: 150; c: 100; d: 0;   length: 1000; } }car_ypos: splines { cubic { a: 128; b: 128; c: 128; d: 128; length: 1000; } }
car_zpos: splines { cubic { a: 80;  b: 78;  c:  50; d: 15;  length: 1000; } }
car_roll: 0;


The roll is 0, as expected. The x position runs from 255 (point a) to 0 (point d), with intermediate control points at 150 and 100. The y position is 128 all the time. The z position starts at 80, and ends at 15 (points a and d). Point b at 78 is almost the same height as point a, so near the start the path is almost level. Point c is much higher than point d, so it goes down more steeply.


So far, it all looks good, but getting to the point of a car following the track on the screen will be quite some work. Then we will see whether the above math actually works :)

Saturday, 19 October 2013

Quick update

Just a quick update to let you know we're still here!

Recent changes


Languages

You can now change language ingame, via the new settings window. Language strings appreciated!

Bug fixes

There had been a nasty bug for quite some time where FreeRCT crashed whenever a guest visited a shop. Since that is still basically our main 'feature', it was somewhat important that we got that fixed.

Numerous other minor fixes, including a memory leak in rcdgen.

Build System

As some of you may have noticed, FreeRCT's build system has been switched to a CMake system. This makes cross-platform much easier (Build Instructions here). However, there are some notes:


  • Existing checkouts may be broken, due to CMake not recognising existing generated files. To fix this, you must delete the existing generated files
    With svn, this can be done with:
    "svn st --no-ignore | grep '^I' | awk '{print $2}' | xargs rm -rf"
    Remember to backup your freerct.cfg !

  • Please test the build system on your OS, whatever it is and report any problems you have, to the bug tracker. FreeRCT should build on all Operating systems now, but there might be some problems with the build system initially. Note that we cannot help you with regards to installing individual libraries, as we have no idea ourselves, but if you manage it and the process is particularly difficult, tell us how so we can add it to the wiki.
EDIT: Existing translations can be found here, in the default_**.txt files

Thanks
Lord Aro

Saturday, 7 September 2013

Birthday surprise: Coaster tracks!

Hello all,

Time sure flies when you're busy. Next week it is the second birthday of the project.

Look at the right what present we got?

Indeed, you can build tracks of a roller coaster. It's still very rough version. Delete doesn't work, back and forward doesn't work either. Platforms are still invisible. But who cares, One big step towards getting a playable game!

Monday, 20 May 2013

Hurdles

It has been a while since the last blog about the development.
Those of you that follow the commit logs, know development has not stopped.
The main reason not to post anything is that there is not much to show to you. All changes are preparation for the next step, namely getting a roller coaster rolling. It looks like it's going to be a long ride with a lot of hurdles.

After getting all the nice coaster ride sprites from Richard, the first hurdle was getting them loaded in the game. The Python RCD file generator didn't want to co-operate, so I spent a month on ditching the thing. We now have a shiny new C++ implementation. Not only is the generation process faster (which will be useful with larger roller coasters, the number of sprites is going to explode!), it also means you don't need Python any more to build RCD files. This is very useful for whoever is going to enable development at windows.

The next hurdle was making room for coaster data inside the game. A roller coaster is a 'ride', just like the shop (with both, a guest enters, does something, and leaves again). Thus logically a coaster belongs next to the shop. The code however did not agree sufficiently, so I have been pushing it into a better shape for some weeks. The game can now load the coaster sprite data (it contains a lot more than just the sprite, the shape of every piece is also stored, and which piece can be connected to which other piece).

The previous hurdle is still causing some small trouble, but that's manageable. The next hurdle I somewhat expected, but yesterday I found out how large it was exactly. It is not a pretty sight :(

Once you can load pieces of track, the next thing you want is to allow the world to display it. (Basically, you want to be able to say "draw that track piece at this position in the world".) Displaying it is the stepping stone to making a GUI window for editing coaster tracks in the world. (And having a rollercoaster ride in the world is in its turn the stepping stone to adding cars, and adding physics so the cars move in virtual gravity.)

Unfortunately, the current display storage doesn't even look right. It will need a lot of restructuring to push it into any usable shape. It might be easier to just write the thing again. What's worse, there is a lot of code attached to that display storage. Paths decide how they connect, shops decide where they can be placed, guests decide where they can walk. A small change in the display storage has already a large impact, let alone a major restructuring like I need to do.


So this is what is happening. We're not dead, far from it.
There are 'just' an unknown number of hurdles in the way, and I am fighting with a big one for the next weeks or months.

Monday, 6 May 2013

Contributing and Info

It has become apparent that some people who would like to contribute to the project are unable to do so, as they do not know what needs to be done. Short answer: Everything!

Seriously. The project is still in its early stages, and any contributions are welcome. A guide to contributing is located at our wiki, specifically here. Hopefully all the necessary information is there. Comment below if you feel something is missing.

Also set up recently was a 'Google Group'. You should be able to use this to discuss things and future content etc. (Although what you'd actually usefully discuss is somewhat unknown at this time)

Oh, we also have a FaceBook page. It's, umm, quiet.

In FreeRCT development news, preliminary work is being done to add the first Roller Coasters!

Any other questions, leave a comment below!