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!

Here's a peaceful little forest scene for this #screenshotsaturday, from the beginning of the game.

Sometimes the suction cup get sticky. Small animation I made in Blender after doing my tutorial on picking up/dropping objects in animations. Crate model by jQueary (https://sketchfab.com/3d-models/game-ready-sci-fi-crate-d98deca6…).

An infected room from the second part of Cybel ! Are you up for some cleansing?

it happens

OK, this starts to be too tricky puzzle already :D

#platformer #indiegame #puzzle

blender animation experimentation, getting the hang of things fast. arms, rig, & gun models by me ofc

A sneak peek at the new OST, can you guess what this song will be used for? 🤔

Double Rainbow!!!