May 242010
Lightspeed
by Hannes Rahm
Lightspeed

We are back with another Experimental Gameplay Project-entry.
The theme for May was "High Velocity" and our game is called Lightspeed.

Fly through hoops to gain points and speed. You get 20 seconds.
Black and white hoops accelerate you and gives you points. The faster you go, the more points you get.
If you fly through a blue hoop you get an extra second.

You build combo points by flying through several black or white rings in succession. If you have combo points you can Boost for additional speed.

When the time runs out you enter your name, and your score is posted to our online leaderboards.

We couldn't fit learning OpenAL into our schedule so the game is painfully silent. Maybe if you ask us nicely we'll crank something out ;)

Controls:
Steer with mouse.
Boost with left-mouse-button.
If the game is running slowly, use C to turn off clouds or reduce your desktop resolution.

Prerequisites:
Windows: .net Framework 2.0.
OSX and Linux: Download and install the latest version of mono from: http://www.mono-project.com/.

DownloadLightspeed-button

To run on Windows: Lightspeed.exe, Linux: Lightspeed-Linux.sh, OSX: Lightspeed-OSX.command. (Or just run mono Lightspeed.exe in a console)

Tech
I (Hannes) recently bought a macbook, and since I don't really want to run windows on it we decided to try some cross-platform development. We settled on C# + OpenTK. Through the seemingly miraculous power of Mono the same binaries seems to work on both Windows, OSX and Linux.

I code in MonoDevelop on the mac and Alfred code using Visual C# Express. MonoDevelop can use the vs-solution files natively so no problems there really. We have our own subversion server to help with the collaboration.

This is a very simple game, but I am very impressed with Mono and OpenTK!

There have been only a few problems with the cross-platform setup.
1) Loading transparent png's work differently on the different platforms. On Mono we have to convert from premultiplied-alpha manually. If you see black halos around your transparent images when running your games on Mono. Try doing this to the textures on load:

int id = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, id);

Bitmap bmp = new Bitmap(filename);
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
int PixelSize=4;

// Fix premultiplied Alpha in mono
int p = (int) Environment.OSVersion.Platform;
if ((p == 4) || (p == 6) || (p == 128))
{
unsafe
{
for(int y=0; y<bmp_data.Height; y++)
{
byte* row=(byte *)bmp_data.Scan0+(y*bmp_data.Stride);

for(int x=0; x<bmp_data.Width; x++)
{
float a = (float)(row[x*PixelSize+3])/255.0f;
float r = (float)(row[x*PixelSize+2])/255.0f;
float g = (float)(row[x*PixelSize+1])/255.0f;
float b = (float)(row[x*PixelSize+0])/255.0f;

r = r/a;
g = g/a;
b = b/a;

row[x*PixelSize+2] = (byte)(r*255.0f);
row[x*PixelSize+1] = (byte)(g*255.0f);
row[x*PixelSize+0] = (byte)(b*255.0f);
}
}
}
}

GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, bmp_data.Width, bmp_data.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);

bmp.UnlockBits(bmp_data);

GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

2) Setting mouse position on mono (osx atleast). To be able to use delta mouse movement to steer we wanted to center the mousepointer between every frame. It seems that Cursor.Position = new Point2(..) locks the mouse position for a couple of hundred milliseconds. This makes the center-on-every-frame-technique unusable. We don't have a good solution to this atm. We had to settle for just checking the delta of the mouseposition each frame, which works but only until you hit the screen edge. You can press Space to recenter the mouse if things go bad. For this game you go pretty much straight ahead, so it's not that big of a problem.

Anyway, we hope you enjoy our little game!

Huggies
/Hannes and Alfred
archived as: experimental gameplay project,opentk,mono,linux,osx,premultiplied alpha
 

11 comment(s) for “Lightspeed”

  1. Gravatar of Maska

    Maska Says:
    Seems that the game remembers the direction one was heading when the time runs out and centers the steering to that for the next round. This renders the game unplayable for a couple of rounds, if one happened to look too much away from the starting direction.

    Anyway the game is a bit too much based on luck, as it's practically impossible to get a long run without first getting boosted by a couple of long straight tubes and then getting random single ring sections. It is also impossible to get time fast enough at normal speed in the random ring sections. Longer tubes - no matter at what speed - always cost time.

    A high scoring run is only possible if one gets a level of mainly straight tubes and random sections. If the speed runs out, it would be nice to be able to make a comeback just by skillfully getting them random rings.
  2. Gravatar of Maska

    Maska Says:
    Further notes: the first run of a game session has always been a lot easier and higher scoring than the tries after that. All of my scores that are notably better than my previous ones were played with the first run.
  3. Gravatar of Hannes

    Hannes Says:
    Sorry I havn't been able to get back to you earlier, extremely busy schedule.

    Agree on the comments you made.

    It's a prototype so it's bound to be a bit buggy (the non centered start thing).

    The random rings are way too punishing to get, and the straight "tubes" are way to rewarding.
    Some heavy tuning is required here if we would expand on this concept.

    About the "first run higher score" we don't really know. Maybe you start with higher speed on the first run or something.

    We are considering to make a v 1.1 with some fixes to to the things you mentioned plus sound and music and maybe another gameplay thingie.

    Thanks for taking the time to play and comment! Appreciated!
  4. Gravatar of registry cleaner optimizer

    registry cleaner optimizer Says:
    I really enjoyed this post, especially the “examples in this post” portion which made it really easy for me to SEE what you were talking about without even having to leave the article. Thanks
  5. Gravatar of home loan

    home loan Says:
    good information you

    write it very clean. I am very lucky to get this tips from you.
    http://juankaan.org/forum/member.php?u=7483

  6. Gravatar of Hyipsuccess

    Hyipsuccess Says:
    [b]Professional HYIP - high yield investment programs rating and monitoring, expert investment advisor and can help with investment services. Only trusted hyip programs listed, invest without risk.
    [/b]
    [URL=http://hyipsuccess.com/][IMG]http://i073.radikal.ru/1007/be/438ae110a52f.jpg[/IMG][/URL]
    [url=http://hyipsuccess.com/]hyip compare[/url]
    [url=http://hyipsuccess.com/]hyip-list[/url]
    [url=http://hyipsuccess.com/]strictpay[/url]

  7. Gravatar of make money easy

    make money easy Says:
    Thank you for useful info. :-)
  8. Gravatar of vazor222

    vazor222 Says:
    Great writeup, and nice entry for the theme! Enjoyed the mixing-up of goals you have in your design.
  9. Gravatar of FantasiaMausssg

    FantasiaMausssg Says:
    http://mrfox394.vox.com/library/post/megan-fox-naked.html , http://paris-hilton-sex-tape.com/2010/08/15/megan-fox-naked
    megan fox naked In order to tap into the sometimes contentious camaraderie that Marshall and Kim have shared over the years, Monaghan hearkened back to some of the most notorious couples of all time. "We're supposed to be desperately in love, like Sid and Nancy, John and Yoko ... Eminem and Kim," he said. "Though I tried as hard as I could to make her laugh and have fun with her. I think we got on pretty well." In one scene in a bar, Monaghan described a scenario where he has to roll up on another gentleman who is talking to Fox's character, and the actress asked what she should call him when he comes over and is about to hit the guy. "I said, call me Slim," he said. " 'Cuz that's who I am essentially. I was playing Slim Shady and trying as hard as I could to be Slim Shady." [url=http://mrfox394.vox.com/library/post/megan-fox-naked.html] megan fox naked [/url], [url=http://paris-hilton-sex-tape.com/2010/08/15/megan-fox-naked] megan fox naked [/url]
    and get all the pictures and videos you want of this hot young celebrity. Wank off to your heart’s content with the extensive collection of naked Megan Fox pics and vids available at this site. megan fox naked pictures
    [url=http://plone.org/author/jblackjms] megan fox naked [/url], [url=http://profiles.tigweb.org/peterblack294] megan fox naked [/url]
    http://plone.org/author/jblackjms , http://profiles.tigweb.org/peterblack294, [url=http://paris-hilton-sex-tape.com] paris hilton [/url]
    Famed video director, Joseph Kahn is reportedly the mastermind behind the video, which he apparently wrote in just 45 minutes. Truthfully I’m surprised it took that long, writing “Megan Fox naked” only takes about 30 seconds, and that’s really all he needs. megan fox naked pictures
  10. Gravatar of crazygracemon

    crazygracemon Says:
    Mary Kay Cosmetics Natural Skincare Tips

    You will find a number of things you can do to enhance the texture, elasticity and appearance of the skin. The very first 3actions are an essential foundation to flawless skin.No matter how much you pay for costly moisturizers that promise youthful, more healthy smooth skin, should you don't do the 3step cleansing routine (cleanse, tone & moisturize), it is unlikely that these products will have any real benefit to the skin on your face.

    1. Cleanse - Start your skin careroutine with a facial cleanser, by Mary KayCosmetics. That's it! No additives that can cause irritation to your skin especially if you have sensitive skin. You can use the Mary Kay Cosmetics cleanser by simply wetting your face to rinse. Remove the cleanser by using a MaryKay® Facial Cleansing Cloths.

    2. Tone - Next, using cotton wool and Mary Kay Purifying Freshener to take off the last traces of cleanser and tone the skin. Have you tried Flower Waters? They aresuper advantageous to the health of the skin as they are organic and contain anti-bacterial properties which stop bacteria growth which in turn stops rashes and spots. Some also have astringent properties which close pores, and make the skin much more toned. Some great ones to try are good old water - cold, rosewater (good for mature skin too), orange flower water andnaturalwitch hazel. Avoid toners with alcohol as these will dryout your skin which will compromise your efforts.

    3. Moisturise - This step is essential to wholesome skin. You need to replace lost moisture to the skin and this is best done with Mary Kay Balancing Moisturizer Cream to suit your skin type. The most common are sensitive skin, oily skin, dry skin and combination skin, so look out for these descriptions when purchasing creams.

    4. Sun Cream - Stay out of the sun - UV rays induce the skin to age, consequentlyuse a factor that is appropriate for your skin type for greatest sun protection. Mary Kay Sun Care Collection is an exceptional choice.

    5. Avoid Free Radicals - What are they? See our article on free radicals for further facts, but in a few words the yare substances that set off the skin to grow older and wrinkle. Use Anti-oxidants tocounteract free radicals that age the skin. Vitamin A, C & E are particularly useful in addition to coconut and olive oil. A handful of almonds are crammed with sufficient vitamin E to counteract free radicals.

    6. Water - yes, consuming water really does help to get rid of poisons and re-hydrate your skin. Roughly 2 litres per day (8x 250ml glasses).

    7. Serums - These are nutritious oils with an ingredient to help carry the oils into the deeper levels of the skin so theyimprove the tone and elasticity. It is best to use the treatment twice a day, once in the early morning a few minutes before you moisturise and again before you go to bed so that it can do its work whilst you sleep. Mary Kay Cosmetics TimeWise® Replenishing Serum+C is an excellent choice.

    8. Face Mask - Use a Mary Kay TimeWise® Even Complexion Mask as a weekly treatment.

    9. Rest - Sleep is one of the best things you are able to do for your skin.

    These suggestions should not be used as a one off, butincorporated into a regular skin care routine for best effects.

    For more information on the Mary Kay Cosmetics Skin Care line please visit

    [url=http://rare-beauty.net/Mary-Kay-Cosmetics-Shoppe/?p=85]Makeup Tips For Professional Women[/url]
  11. Gravatar of Moomemafonent

    Moomemafonent Says:
    Hello
    In my opinion you are not right. I am assured. Let's discuss. Write to me in PM, we will communicate.
    [url=http://hcl50mg.web4.me/49/map.html]tramadol clorhidrato genfar map 602[/url]

    Good luck

Leave comment:

Name:  
Email:  
Website:
Comment: