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!

So

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

Have a good Boi

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

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

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

The Darkside Detective: A Fumble in the Dark is out TODAY! 🖱️Advanced pointing, clicking action 🖨️Very funny words! Loads of them! 👻6 sarcastic, spectral cases to solve

Call it 'wrong turn'!🚫 The feeling of running into a house with only one exit🚪, and being doomed to die. #pixelart #pixelartist #pixelartwork #art #pixel #indiegame #IndieGameDev #indieartist

Auto-chess meets Clash Royale in an intense strategic battle. Outsmart your opponent, hide your play and crush their armies! Empire Builder just got another major update, check it out! https://gamejolt.com/games/EmpireBuilder/558901

If you’ve played the Vault demo and enjoyed it, please consider ‘liking’ the game page here on Gamejolt and/or leave a comment!

Also please consider tossing Vault on your Wishlist, I really appreciate your support!

https://store.steampowered.com/app/1251800

Our menu, gathered a huge feedback and positive comments among foreign audience, what you say? Game Steam: https://store.steampowered.com/app/1543090/LiBER/