iDevGames Forums
what's the best way to create rolling terrain with Cocos2D? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: what's the best way to create rolling terrain with Cocos2D? (/thread-8991.html)



what's the best way to create rolling terrain with Cocos2D? - aerospaceman - May 24, 2011 08:55 AM

I'd like to make a side scrolling flying game where the terrain (hills) is generated using mathematical functions .
Has anyone done that and if so, what's the best way to store all that data and to display it in Cocos2D?


RE: what's the best way to create rolling terrain with Cocos2D? - Skorche - May 24, 2011 10:24 AM

Write your own OpenGL rendering inside of a Cocos2D node's draw method. Unless you want to make a tileset to do it... eww.

Cocos2D's utter lack of state management is pretty frustrating when writing your own rendering functions though.


RE: what's the best way to create rolling terrain with Cocos2D? - skyhawk - May 24, 2011 01:36 PM

I am suspecting you want to duplicate tinywings. See http://www.cocos2d-iphone.org/forum/topic/14136


RE: what's the best way to create rolling terrain with Cocos2D? - Skorche - May 24, 2011 02:15 PM

Ugh. So much misinformation in that thread. Pixel shaders to procedurally draw a 1D heightmap? Really?

All you need is a triangle strip and a repeating texture. That's how ByteRacer does it: http://howlingmoonsoftware.com/extras.php and it's trivial.

The shading on the hills could be done with simple vertex coloring.