Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 3d terrain generation in App Game kit

Author
Message
DaveAgk
12
Years of Service
User Offline
Joined: 21st May 2012
Location:
Posted: 19th Dec 2015 14:41
Are there any code examples for generating a terrain in AppGameKit ?
AJCodes
9
Years of Service
User Offline
Joined: 6th Jan 2015
Location:
Posted: 19th Dec 2015 18:21
Sooner or later I'll include some code, but the process is pretty easy, if not TRUE terrain gen.

I used Blender to create a plane...choose a size you like. I started with HUGE, but then quickly realized that I should be using multiple smaller planes. Try 128x128 to start.

Export that as an .obj.

Import into the game. Attach a high resolution image to it...I implemented drawing on that texture, as well as some simple splat mapping thru shaders.

Turn the .obj into a memblock.

Now write a quick routine that moves the planes vertices based on whatever you like. I started with a .png but then just moved to an array of floats for accuracy.
for i =
for j =
vertex = i*128+j
move the vertex up or down
next
next

You can then save the edited object for use...or do all of this is Blender and just use the resulting .obj. And then, once you do that, you'll get all kinds of other ideas about what to do...I've got a level editor working right now with the ability to create simple objects for walls/floors and import complex objects to simply scale and place. Nothing really usable right now, but fun to play with on the way.
Born. Currently living.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 19th Dec 2015 23:43
Check out this post. The code will create a terrain from a height map.
https://forum.thegamecreators.com/thread/203224
The coffee is lovely dark and deep,and I have code to write before I sleep.

Login to post a reply

Server time is: 2024-11-25 13:40:47
Your offset time is: 2024-11-25 13:40:47