Game
2DLands
7 years ago

Rendering the world: Part 1


Today i wanna show you guys how i render the whole world with shaders.

Attempt №1

Imagine that you have a grid of blocks, you have their textures and other stuff like hardness, roughness and etc. Basically what you might do to render whole world is by adding a parent block, that will have a lot of parameters. But this way inefficient at least for GameMaker, even YYC won’t handle whole world that has a lot of objects.

Attempt №2

What will be your next try? How about arrays? Ye arrays can improve our performance, but how about ds_grids? They will work way faster with a lots of numbers since it has built-in functions like ds_grid_clear or ds_grid_set_region that can use something like memset in C++ version of their representation. But how will we ever render this whole grid? How about 2 for loops that will render it? Ye we can try that! But wait, the performance is still low, what did we do wrong? So apparently we rendered the whole world, instead of region that we can actually see! Aha! Just put view’s position and size and we ready to go! Still not satisfied with the performance? Well…

Attempt №3

Okay, how about shaders? They pretty powerful and can render whole world like 30 times faster that CPU can! We must use them! But… How we gonna pass the data that correspond our purposes? How about surfaces? We can create a surface, that can store all blocks in chunk, where pixel’s color will be represent Block ID(BID), we need to write all data from our grid about each block to that surface and render it somehow.



0 comments

Loading...

Next up

Just first post to say Hello World!

This Satuday we invite to watch another #speedpainting of our artist Daniel Faiad.

How great is this scene of #Pecaminosa?

#ScreenShotSaturday | #IndieDev | #DigitalArt

"Thanks guys for endless hours of fun." 👍

(My first fan art. Read the article, please.)

#sonic #mario #photoshop

Another house i made long time ago.

Quantum precognition is one of the most powerful cards. End game cards & equipment. Demo/alpha build boss is no match for this deck.

What you all think

Back in my art school days I used to ride the 710 COPSA line from Parque Del Plata to Montevideo almost everyday. This is the Marcopolo Viaggio G4 Mercedes Benz model from the late 80s, one of the older bus models that was running on the line.

Strange Umbrella

Finished work on the emotions of a new character for the tank universe

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!