Page 1 of 1

Twilight Golf (and promo code giveaway)

Posted: Mon Oct 19, 2009 5:53 pm
by slembcke
We are just about to release our new game, Twilight Golf. \o/

http://howlingmoonsoftware.com/twilightGolf.php

It's a physics based minigolf like puzzle game for the iPhone. It also features super fast dynamic 2D shadows and lighting. We figured out a neat trick to make it so all the expensive shadow geometry gets calculated on the GPU. :)

We are running a promo code giveaway for a pre-release copy tomorrow. Details are here, but basically we are giving 10 codes away to people who tweet with #twilightgolf and 10 to people who have joined the Twilight Golf Facebook page.

Cheers!

Re: Twilight Golf (and promo code giveaway)

Posted: Tue Oct 20, 2009 1:17 am
by Tam Toucan
That lighting is really nice. Good luck with this.

Re: Twilight Golf (and promo code giveaway)

Posted: Tue Oct 20, 2009 10:56 am
by slembcke
Seems that it was made available a day early.

Full version: http://itunes.apple.com/WebObjects/MZSt ... 18006&mt=8
Lite version: http://itunes.apple.com/WebObjects/MZSt ... 26863&mt=8

Re: Twilight Golf (and promo code giveaway)

Posted: Tue Oct 20, 2009 1:01 pm
by dieterweb
really nice game. Congrats. I hope you are doing very well with it.

I would love an option to increase gravity. Could be a little faster for me.

Thomas

Re: Twilight Golf (and promo code giveaway)

Posted: Tue Oct 20, 2009 3:00 pm
by zaerl
Great work man, really well done.

Re: Twilight Golf (and promo code giveaway)

Posted: Mon Feb 21, 2011 3:08 pm
by eVillain
That lighting effect is amazing; any chance you would share some of that code or implement it into v6? :p
Mainly any hints toward how you store the object data in the GPU would be welcome, as just drawing that sort of lighting into a CCRenderTexture in Cocos2D looks decent but is a real performance bottleneck.
I know I'm not the only one who's interested but I haven't seen much discussion on this here...

edit: BTW the Twilight Golf link at http://wiki.slembcke.net/main/published/HomePage gives me a 404 because of a capital T instead of lowercase.

Re: Twilight Golf (and promo code giveaway)

Posted: Mon Feb 21, 2011 5:32 pm
by slembcke
Meh. Why not. I didn't really come up with the idea. I first saw this effect in a shareware game called Gish around 2004 maybe? It was arguably the coolest thing I'd ever seen in a 2D graphics engine. I had to figure out how to do it, and so I did (before beating Gish even :p). After years of sitting on the code and a half dozen unfinished prototype games that used it, we made Twilight Golf. Unfortunately it sold for crap like so many other iOS games. The game looks terrible in screenshots, and was very difficult to market. We could never get any blogs to post a video of it. We would have made more money working at McDonalds for the month we spent making it... I thought the lighting/shadowing code would be something special to make it stand out, but it didn't. Several people have expressed interest in buying the code, but that ultimately never went anywhere.

It's actually a really easy effect to do, jut a difficult one to do efficiently as it uses a ton of fillrate. Basically you are building a light buffer one light at a time. Without shadows, for each light you just draw a quad with a circular texture on it using additive blending. To cast shadows, you build a shadow mask in the alpha channel. Originally I used the stencil buffer, but the iPhone does not have one. For each shadow casting line segment, you create a quad. Two vertexes of the quad are the original segment vertexes, and the other two are just copies that are projected away from the light source. Once you do this for all the shadow segments, you have a visibility mask that shows where the light can shine. Use this to mask the light when you add it to the light buffer. Multiply the light buffer against your final rendered scene and you are done.

To make it really fast, I use a degenerate perspective transformation of the vertexes to project the shadow segments to infinity instead of wasting time doing it on the CPU. The "normal" edge of the polygon has a z of 0, and the projected side has a z of 0. Other than that the xy coords of the edges match. To cut down on fillrate, we subsampled the lights and used scissoring and partial clears when generating the shadow masks.

Re: Twilight Golf (and promo code giveaway)

Posted: Mon Feb 21, 2011 7:25 pm
by eVillain
Sorry to hear about the marketing difficulties, as you said the game really is such that it needs to be seen in motion to really be appreciated.

I'm pretty sure I can tweak my implementation now, I'll have to run some tests to see how low the res on the lighting would need to go and decide whether to keep it or drop it. For anyone else interested in having a look at how Gish does it the source is available from the developers: http://crypticsea.blogspot.com/2010/05/ ... ource.html

Thanks for the quick reply, it's much appreciated.