August 18, 2014

When Scripting Deserves to Fly

Hello everyone!

It's my very first blog post here, and I'm excited to bring to you the work I did as part of GSoC 2014!
Ever thought of an awesome and fun feature for a track you loved? Wanted the sheep in Green Valley to run away as you passed them by? Well, I've been working on a shiny new Scripting Engine for SuperTuxKart to allow all that and more. The best part is that scripting makes it unbelievably easy (and fun) to create good game loops! If you wish to know more, more details are available at http://supertuxkart.sourceforge.net/Scripting

The first part of my project was to come up with a good language and an  intuitive and user-friendly scripting API. With this in mind, I chose AngelScript as the language, due to a variety of reasons, chief among them the fact that it had good synergy with our existing code. Most of my work went into refactoring existing code so as to expose that functionality to the API. Right now, most of the different track elements you see like animations, static objects have had various properties exposed to the API. I've also added several different ways of triggering scripts, from action-triggers (Think bubbles that pop and run a script when you enter it) to collisions (between karts, items and track-objects). In addition some miscellaneous classes have also been bound ( For example 3-D vectors ), to make life easier for anyone writing scripts.

The API is pretty comprehensive at this point (You can find the API documentation at http://supertuxkart.sourceforge.net/Scripting_API), and I intend to broaden it further to allow more fun stuff to happen during races. I'm still hoping to do quite a bit of work post-GSoC on things like the weather, object behaviors and perhaps some unit testing as well.

I've added a tiny example (which is way more fun when you actually play it), for everyone to get a taste of what scripting will bring! Feel free to pull the ScriptEngine branch at  https://github.com/sachith500/stk-code for even more fun examples! You can find the scripts under stk-code/data/scripts.


An innocent looking barrel appears in Hacienda, let's check it out!




It's a trap!


The barrel has exploded into 2 parts, the rim and wonky-barrel

We'll be adding a video showcasing all the capabilities of the new engine once my work is merged, so stay tuned for more details!

August 13, 2014

SuperTuxKart Track Editor beta released!



Hi everyone!

I am happy to share the good news: the editor is ready for an open beta! Did you always want to create a track, but found Blender too complicated? Are you not afraid of trying a software which may crash? Are you ready to work hours on a track just to kill the program and lose everything? Are you good at finding bugs, reproducing and reporting them? Cool! I’m a pro marketing guy. This is our day!



After the last paragraph I am almost sure you can’t deny your desire to try the editor. How can you get it?

Windows:
For this special event I made a binary version again. You can download it from here:

 https://www.dropbox.com/s/ix7x3350ls7dsg0/editor_beta_gcc.zip

The zip contains an editor directory. Move it to your stk data directory, which contains Textures, Tracks, etc. All you have to do then is run the exe.

Linux:
If you are a Linux user unfortunately you have to build the sources yourself – I doubt it will cause much pain anyway.
The repository is still the same: https://github.com/mcsab/stk-editor
You have to build irrlicht as well. Be careful and read the readme – most likely you have to modify an Irrlicht header.
Also, the SuperTuxKart wiki has a manual and a short tutorial for the editor:

If you have any question, idea, or just found a bug, you can find me here, on the forum, or on irc.
I hope you will enjoy your work ;)

Elath

August 2, 2014

Driving on walls? Yes please.

Hello everyone,

So this is my first blog post here, I should apologize for the long silence. For those who might have forgotten, my GSoC project was, simply put, allow karts (AI and player) to drive on walls and upside down. Now that the most of the AI is functionally capable of handling any kind of track that fancies your imagination, I think its now time to discuss some results.

The AI traversing a loop in Newton
Above you can see the AI skidding through a loop in a test track called Newton. (Ignore the flying kart in the middle, its some developer magic.) The AI still uses the old algorithm but now it does something extra. Imagine that the loop is made of a strip of yellow paper. Cut out the loop and flatten it on an imaginary table, and now try to navigate this flat loop using the old algorithm. Sounds easy right? That’s what the AI is doing, except its a little bit tricky to do in code ;) Once I got the steering right, the skidding “just worked”, which was nice.
Next we look at items. They are now auto-aligned depending on which section of the track they are placed at. These include bonus boxes, bananas, nitro etc.
An AI kart collecting a bonus box on a vertical section of the track
Powerups like bowling balls, cake, basketball and rubber band have also been fixed to work when being thrown from any orientation. Bowling balls will now follow the track instead of falling down. The cake and rubber band will now hit the target irrespective of what direction the opponent is going (assuming you are in range). The basketball has been fixed to bounce in the direction perpendicular to the track instead of the up-direction. It will now follow the track as you would expect.


The rescue animation was also required to be adjusted so that the kart is dropped in the correct place, with the correct orientation. If you are upside down when you drive off the track, then that is how you should be placed back. This turned out to be a bit tricky due to a bug between irrlicht and the physics engine but thanks to hiker’s expertise this was fixed. Along with this, the explosion animation is also fixed to be perpendicular to the track.

for the lulz
Most of the AI including items and other features had been previously designed with a horizontal track in mind. This lead to the AI being coupled with the coordinate system, ex. directly using the Y axis for many operations. Majority of the work has been done to decouple the coordinate system and AI.


All said and done, this project is not complete until we get some feedback from you, our loyal players. You may check out the source here https://github.com/lurk26/stk-code , branch: walldriving. Build and run as usual and let us know what can be improved, and if you find a bug, even better :)