Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Some code sharing (3D action RPG WIP, infinite Terrain rendering, Mandelbulb)...

edited January 2014 in General Posts: 196

Hey all and happy new year,

I've been extremely inactive this past year having to deal with the hassle of getting a new job and a new house, only to lose them both when all seemed so fine... Anyways, now that I'm finally stable again, i'm slowly getting back into Codea and my passion of programming altogether.

So yeah, I remember I was supposed to share some code after I had "cleaned" it up but I never got to it..
Unfortunately, I have lost a lot of source code due to being careless this year and this is the only "concrete" stuff I could recover so far (this is from pastebin.. I still have some local folders I haven't gone through but it's a mess).. Note that what you see in the videos might not be exactly what the code does, due to having shot the videos on more recent code..

Action RPG game WIP:
This one I was having a blast with, but I lost a lot of the source so I sort of gave up on it...Original discussion here.
You'll find the source code here.


Mandelbulb:
Original discussion here.
You'll find the source code here.


Terrain engine:
This one is a bit off-topic. I originally started working on it in Codea, but generating the terrain was too slow.
Since I really wanted infinite terrain generated on the fly, I ended up porting and finishing it in webGL (web workers help a lot). What I'm working on right now is generating the heightmaps on a server and sending them to Codea for rendering.
So well, until I get my Codea version working, you can find the (dirty) javascript/webGL source code here.
You can also try it live here (Note that you need a webGL enabled browser).

For those interested in keeping up, my website is charpie.fr. It might contain additional info that I would rather not pollute the forums with if it's non-Codea related stuff.

Please let me know if you have any questions regarding the code.

Cheers
Xavier

Tagged:

Comments

  • Posts: 577

    @Xavier =D>

  • edited January 2014 Posts: 835

    @Xavier, I was jw what parts of the source code were missing, bc I would love to try and recreate it

  • edited January 2014 Posts: 196

    @CodeaNoob hey, well from looking at the code, only the RPG game is missing stuff in order to be able to be launched on Codea. The dropbox folder is obviously missing. You can get the data here.
    Really sorry for the mess, but all the graphics data should be there.

    Note that the 3D models are exported to images in blender (I talked about it in this post) . It's normal that they look totally messy, they're encoded vertices/normals/texture coordinates.

    As for the shaders, well it's a simple toon shader with a vec3 uniform that holds the light position for the shading..

    Regarding what is actually missing from what is in the video, I really couldn't say.. There is a 1 month diff between the source and the video post date, and I was pretty active at the time, so probably a good bit :/

  • Jmv38Jmv38 Mod
    Posts: 3,277

    @xavier great to here from you back again! Welcome back! Thanks for sharing your amazing stuff!

  • Posts: 2,820

    Welcome back! Thanks for sharing the code. Is there by any chance an RSS feed on your website?
    Thanks!

  • IgnatzIgnatz Mod
    Posts: 5,396

    @Xavier - I'd love to see more of the infinite terrain stuff, I love the texture you're using and the cliff effects.

    I've been creating terrain in Codea using noise or the diamond square algorithm, and I can get up to about 5000x5000 without dropping FPS too far, as long as I don't decorate the terrain too much of course! It works fine for a lunar landscape, with a little diffuse lighting.

    I've been thinking about how to do infinite terrain, but it is difficult...

  • edited January 2014 Posts: 196

    @Zoyt thanks ! i don't have a RSS feed ATM. I'll work on adding one though.

    @Ignatz Yeah I really wanted an infinite (and 'nice' looking) terrain but I was struggling too much with raw speed in lua, took way too long to generate the terrain and its normal map :(
    I'm really interested in giving marching cubes a go too (well not exactly marching cubes but an updated approach) for triangulizing voxel terrain...Really like what they did with the Voxel Farm engine in Everquest Next Landmark... I was amazed at this and have been hooked ever since ^^

    Anyways, regarding my terrain code, I use triplanar texturing to prevent the common distortion we get on heightmaps.
    I recommend checking this great post out (3rd post in the thread) here if you're not familiar with it. It does come with the price of extra texture lookups though. Mix it with terrain normals and it looks pretty nice.

    As for the cliff effects, erosion does a great job. There is an awesome post regrouping all that info here.

    There were also projected shadows (still there, just disabled) but I had speed issues carrying the shadow over to the neighbour chunks so I put them aside for now. They are generated very quickly (sacrifice is that sun can only path along east/west but you can't really notice that in-game). You can read more about this trick in this great 10 part article, more precisely in this post.

    As for the "infinite" terrain, I feel like quadtrees are a pretty nice way to "organize" your chunks, and that's why I went with something similar to the chunked lod algorithm (only i ignored the terrain decimation, as I really don't think it's necessary on today's hardware).

    Cheers

  • @Xavier that infinite terrain is so awsome! It Kinda reminds me of arma 2 with those huge maps but not infinite. I like the realistic look of it =D>

  • edited January 2014 Posts: 140

    Are fractals "out" for terrain generation?

    (Yes, I am that far behind on this topic... :-S )

  • Posts: 1,595

    @Syntonica I think fractals are too expensive for procedural 3d terrain as it gets considerably slower the more you have to iterate through the algorithm.

Sign In or Register to comment.