What is going on guys it is realtouchgml here back with another minecraft tutorial the response in this series is great so far so of course i’m gonna keep delivering and bringing you tutorials all the time i guess all right so today we’re going to do be doing something pretty exciting We’re actually going to start infinite terrain and a rendering system okay so what do i mean by this basically uh infinite terrain and a rendering system so all right let’s just go ahead and start that now i guess uh let me go and run the game here and As you can see we have a nice little guy here we i actually in the last story i forgot to uh start the walking animation so we’ll do that again today but as you can see there’s just this one little chunk here and this is by by all means not an infinite terrain Okay um so that’s yeah let’s go ahead and start that up all right so first off what we’re gonna do is we’re gonna go into the generate script here and we’re gonna just change a few things so first off what we’re going to change is this for loop here we’re actually Going to create a new variable system var starting room and this is going to equal argument zero and we’re going to say var ending room and dean room equals argument zero plus 1600 so basically each chunk that we are creating is going to be 1600 uh pixels long So in here we’re gonna put the starting room at the xx and the ending room at the excess less than all right so there we go so now we have that started now what we need to do since we have an argument in here we need to go Into the create event and we need to actually set an argument in here so i’m going to put 0 because we’re going to actually start the room out at zero all right so if we went ahead and ran it now everything should be the same uh but we uh We should just still have the same room size here and that’s one thing that kind of when i first thought about i said you know how would you do infinite terrain uh you’ve got this room size i mean yes you can make it like a super big room and Kind of simulate uh terrain but then i was like you know what that’s not infinite terrain so i’m gonna set the width of 1600 just for the first uh chunk size here but what we’re going to do is in the views here enable views but don’t make it follow the player Basically what we’re going to do is we’re going to manually create this this function of the object following all right so basically in game maker this room is just kind of like a workspace sort of game maker made it just kind of like a a room workspace So there in essence this room is actually infinite itself this is just a better interface that game maker went with yo-yo games to make it easier for the for the user to create stuff so with that said we can go to the player here in the step event we can say view underscore X view zero equals x minus view underscore w view zero divided by two all right so if we ran it now let’s go and let it compile here as you can see we’re stuck there we go so as you can see it’s now we we do get the same view and we’re Gonna have to do the uh the y view as well let’s do that now actually so let’s copy this let’s paste it down and we’ll say y view y and h view so now what we’ve done is we’ve kind of simulated the view function with the rooms So as you can see here we are and we’ve got our nice little chunk size here but it drops off and that’s why we’re gonna be doing infinite terrain here all right so let us begin so first off yeah we’re also gonna let’s go back into the gen right here and We’re gonna return ending room because we’re gonna want this argument here this variable we’re gonna want to check when the end when it ends and then when it ends we’re then going to create another chunk on top of it all right so in the player here in the step event What we’re going to say is if x is greater than or equal to and actually i’m getting a little ahead of myself here all right let me let me do one thing here so in the create event in object generate create a variable global dot length equals generate zero so this right here Is going to take the variable status of our ending room so basically 1600 is what length now equals to so in our object player here we can say if x is greater than or equal to global.length divided by two because we’re going to create the next chunk when it is halfway When the player is halfway through one chunk it’s going to create the next chunk and and can create which is a variable we’re going to create we’re going to set can create equal false and we’re going to say global.length equals generate global.length and then can create equals true again And let’s go and create that variable can create equals true we’ll say all right so if we run it now i’ll just show you it and then i will kind of explain it a little bit more so here we are we have our player and we’re walking we’re walking and Again we have to do that walking animation and we have a huge little ocean here and this is a glitch i was going to get into in a second just bear with me now so here we go so as you can see we are going a little farther Than we did last time and this is infinite terrain it will never stop alrighty so that’s that’s pretty awesome uh as far as i’m concerned that’s really awesome uh so this only goes to the right side though we need to we need to go to the left side all right All righty so let’s get into the left side of the screen so basically what i’m going to do is i’m going to the object generate here and in the create event i’m going to create an another variable kind of stuttered there so i’m going to say global.length 2 equals global.length because we want Them to both equal sixteen hundred all right so now what we’re going to do and we create the other variables because we need to check what the current chunk is at for the left side and the right side all right so if we go into the object player here Let me go into the step event and with this we say if facing equals one then we’re going to do this code so copy that do that just kind of indent it a little bit let’s copy and paste this now else boom negative one because that’s facing left and instead Of all this length we’re gonna just say length two length two length two minus thirty two hundred because we do generate from left to right so we need to start it generating from far to the left so since we already equal length 2 to 1600 first off we’re going to say minus 1600 which would put it to the origin of zero and then if we do another minus 1600 that would put it to the left so we’re generating a chunk to the left of us all right so if we run it oh and actually you know what i forget i forgot to do something Stop that um you also need to say is less than equal to not greater than equal to all right so now let’s run it and we don’t have the player starting in the middle so you’re actually going to see it warp if i hit left you can see a generator right there but If we keep going right as you can it will generate to the right as well if we go over here we’ve got like this little river type thing and again this is a this is an issue i will uh go across in the next tutorial with the water And we’re going to start the rendering the next tutorial as well so i kind of wanted to get the infinite terrain going and then now that we’ve got the infinite terrain going we can start biomes we can start the render methods we can do all of the fun stuff all right So here we go and let me do the walking animation real quick and there is a little bit of lag here and that will uh stop when we put in the rendering method all right let me do the walk animation real quick uh it’s pretty easy just in here we can say Image speed equals 0.5 copy that paste it down copy those two check released and get rid of this for this zero alrighty so now we have a walking animation so that’s my tutorial for today going to like go and subscribe let’s try for 70 likes this time and we Can do it and uh yeah there we go we got like a little guy that walks now anyways alright so i will see you guys next time you Video Information
This video, titled ‘Game Maker Minecraft Tutorial #4 – Infinite Terrain’, was uploaded by RealTutsGML on 2013-07-25 17:11:24. It has garnered 31455 views and 435 likes. The duration of the video is 00:11:03 or 663 seconds.
Make Video Games 2018 ► https://www.codingmadesimple.com/courses/
In this video we learn how to create an infinite terrain system within our game in Game Maker. 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 ► http://www.twitter.com/realtutsgml Google+ ► http://www.google.com/+RealTutsGML Patreon ► https://www.patreon.com/realtutsgml
Have fun learning!