Make Video Games 2018 ►

In this video we learn how to render a region of the screen which increases speed. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

I’m the founder of codingmadesimple.com that hosts high quality, fun to learn and straight to the point course material for game developers. I’d really appreciate it if you’d check out my content.

Twitter ►
Google+ ►
Patreon ►

Have fun learning!

Nguồn: https://sstievents.org/

Xem thêm bài viết khác: https://sstievents.org/game/

25 Comments

Califlower ,

July 23, 2020

If the water rendering doesn’t work.

Try parenting the water to the object_block so you don’t get lag

Reply

DeathsAngel 213

July 23, 2020

for those that are having the problem with the lighting not working right for the sides of the screen (and apparently somethin with the water to… i never had problems with my water.. the problem i had with water was when my laptop almost commited suicide because how bad it was lagging lol). use this code for the render script…

instance_activate_region(view_xview[0]-50, view_yview[0]-50, view_wview[0]+100, view_hview[0]+100, true);

i took the code from Darthgaul and it did work as well but it was too laggy, so i decided to try lowering the numbers and those numbers work and it doesnt lag at all

Reply

Chris Gumtie

July 23, 2020

FOR THOSE USING GMS2:
The "instance_region_activate()" code will not work, replace it with this:

var cx = camera_get_view_x(view_camera[0]);
var cy = camera_get_view_y(view_camera[0]);
var cw = camera_get_view_width(view_camera[0]);
var ch = camera_get_view_height(view_camera[0]);

instance_activate_region(cx, cy, cw, ch, true);

Reply

marnix mulder

July 23, 2020

my bottom issnt infinite

Reply

Dark Creations

July 23, 2020

If you guys have problems with the water overlap script use this one instead.

///Water Physics

if(x >= view_xview[0] && x <= view_xview[0])
{
if(!place_meeting(x – 16, y, object_block)) instance_create(x – 32, y, object_water);
if(!place_meeting(x + 16, y, object_block)) instance_create(x + 32, y, object_water);
if(!place_meeting(x, y + 16, object_block)) instance_create(x, y + 32, object_water);
}

alarm[0] = 30;

I have fixed the if statement so enjoy!

Reply

Purple Ice

July 23, 2020

30 minutes plus? Dude my computer isn't Potato GTX69 4000GB RAM 72GHZ monster, my game becomes uncrontrollable after walking over like 5 chunks XD

Reply

Gabriel Andrés Henao Tangarife

July 23, 2020

this is a very big problem

Reply

Gabriel Andrés Henao Tangarife

July 23, 2020

is there a way to fix this? :

Reply

Gabriel Andrés Henao Tangarife

July 23, 2020

############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_player:

Push :: Execution Error – Variable Get -7.l(100009, -2147483648)
at gml_Script_generate (line 36) – for(yy = l; yy < stone_level; yy += 32)
############################################################################################
——————————————————————————————–
stack frame is
gml_Script_generate (line 36)
called from – gml_Object_obj_player_StepNormalEvent_1 (line 23) – global.length = generate(global.length);

is there a way to fix this? because every ten seconds of playing my game it shows this message!

Reply

★SwegX

July 23, 2020

Hello fellow programmers! I come to bring you this code to remove all water glitches and a good water physics!

Take it and enjoy!
And to get all the water setteld down first, make the render funktion start first after 5 seconds.

—-Inside Create—-
alarm[0] = 5;

—Inside Alarm 0—

randomize();

if (x >= view_xview[0] && x <= view_xview[0] + view_wview[0]) && (y >= view_yview[0] && y <= view_yview[0] + view_hview[0])
{
if !place_meeting(x,y+32,obj_block_parent) && !place_meeting(x,y+32,obj_ghost_block)
{
   y += 32;
}
else
{
   var dir = choose(0,1);
   
   if dir = 0 && !place_meeting(x+32,y,obj_block_parent) && !place_meeting(x,y+32,obj_ghost_block)
   {
      x +=32;
   }
   else if dir = 0 && !place_meeting(x-32,y,obj_block_parent) && !place_meeting(x,y+32,obj_ghost_block)
   {
      x -= 32;
   }
   
   if dir = 1 && !place_meeting(x-32,y,obj_block_parent) && !place_meeting(x,y+32,obj_ghost_block)
   {
      x -=32;
   }
   else if dir = 0 && !place_meeting(x+32,y,obj_block_parent) && !place_meeting(x,y+32,obj_ghost_block)
   {
      x += 32;
   }
}
}
alarm[0] = 5;

Reply

PierceTheRedstoner

July 23, 2020

Ummm… When You fixed the water chunks the water stopped flowing…

Reply

Spoops

July 23, 2020

_________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object obj_player:

Push :: Execution Error – Variable Get -7.l(100008, -2147483648)
 at gml_Script_generate (line 29) –      for(yy = l; yy < stone_level; yy +=32)
############################################################################################
——————————————————————————————–
stack frame is
gml_Script_generate (line 29)
called from – gml_Object_obj_player_StepNormalEvent_1 (line 22) –    global.length = generate(global.length);

Reply

agge blue

July 23, 2020

I just noticed my blocks doesn't line with eachother when it generates at the edges :/ any idea to what i've done wrong? thanks for any help

Reply

PurposeLess

July 23, 2020

please help me ! Why don't working canCreat?

Reply

CybrNight

July 23, 2020

Why are my chunks missaligned

Reply

CybrNight

July 23, 2020

How could we make it so the terrain is seamless when you generate new chunks, so there isn't just a cliff where a new chunk is put into place

Reply

://SyCx1 Productions

July 23, 2020

i skipped your video about making the character as i already had a character in my game (3d/2.5d platformer) and then when i added the rendering script the left/right chunks stopped loading. i think it has something to do with the view but i am not sure what would cause this. if i comment out the rendering script in my step event the chunks load fine again but of course the game lags after a few chunks. and suggestions as to why the generate script would stop loading left/right chunks while using the rendering script?

Reply

Lance Nelson

July 23, 2020

There are several people who are getting the flickering block problem after adding the "instnace_activate_region…" code. I am hoping someone can have an answer to this situation.
It just seems as though the code runs in a loop, where all blocks are deactivated and then the region is activated and then repeat.

Reply

ICANanimations

July 23, 2020

OMG. did he just call me sexy? … I love you to 😉

Reply

Coedgy

July 23, 2020

I have broblems. My guy is not animated, and when i jump on water he falls in water

Reply

coocoo1995

July 23, 2020

Please add the letters 2 and D in your title to not confuse others into watching your boring video.

Reply

gosh ervin

July 23, 2020

The problem with the water didn't get fixed even though I copied it EXACTLY.

Nevermind, fixed it. From Darthgaul:

"I was wrong it didn't fix it for me either. What did fix it (for me) was actually changing the code in the render script. I noticed that he did this also but never mentioned it, at least that I saw. I caught it for a 1/2 second in a latter video (9 or 10 i think.) Anyway, in the render script, change the instance_activate_region line to read this:

instance_activate_region(view_xview[0]-256, view_yview[0]-256, view_wview[0]+756, view_hview[0]+756, true);

This avtivates the blocks beyond the screen for like 1/2 a chunk. It might make things a little slower but should fix the graphics issues with the water."

Reply

CykaDev

July 23, 2020

I need help, when I go on the left it gives me an error:
stack frame is
gml_Script_generate (line 38)
called from – gml_Object_object_player_StepNormalEvent_1 (line 33) –     global.length2 = generate(global.length2 – 3200);

🙁
Please help meeeeh !

Reply

Eric Pratt

July 23, 2020

I have 4000 + instances of blocks on my sandbox game… I get 10 Frames per second 🙁

Reply

Dewitt

July 23, 2020

my terrain isn't aligned to a grid, check it out >> http://puu.sh/aOMF3/2973695222.png
also, the left terrain generates automactically

Reply

Leave a Reply