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!

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. 😂

What's coming out of your own improvs? 🤔

#Pecaminosa | #IndieDev | #OST | #Jazz

So

i may or may not make an full art of some person or i may just leave this like that-

What do you think guys in my robot?Just a beginner in 3d modeling..

My instagram https://www.instagram.com/rojhonbb/

Just a Pico sprite

Strange Umbrella

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

Microsoft Windows XP Unprofessional (windows logo prototype)

Horror WIP A track that will be featured in a future horror game soundtrack! Stay tuned!

Likes appreciated ✌️

#gamedev #composer #horrorgame #indiegame #IndieGameDev #soundtrack