Building levels WITHOUT a built-in editor

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] when game developers discuss game engines there's a lot of mainstream ones that immediately come to mind there's unity unreal engine game maker studio there's all kinds of them and they're great pieces of software you start up the program and everything you need to get your game going is right there in front of you this type of experience is quite different from my preferred way of making games which is to use a game framework rather than a game engine now everyone has their own definitions on what the difference between a framework and an engine is but a common one that i follow is that a game engine has a complete editor that you work in while a game framework does not on my channel i talk a lot about love 2d and i also have plenty of experience with monogame these are both game frameworks so there's no editor that they come with instead it's very code focused you design your assets using external tools and you bring them into the game with code i really like this setup because everything that happens in your game is very intentional since you have to code in everything specifically an engine like unity would streamline a lot of the processes which is nice and it speeds things up a bit but whenever i use an engine i always feel like i have less control and whether or not that's just a familiarity issue i still definitely prefer frameworks at least for 2d game development but without an editor a very common question that you would get is how do you know what your game looks like and just like unity or any other game engine you would draw up or model your assets or sprites in some external tool like photoshop or blender or really any other image editor so you'll know what your sprites look like but then you'll need to design your levels and the perk with an engine is that you can just drag and drop your objects directly into the editor and you can design your levels that way but framework users do not have that luxury instead just like how we draw our assets up in external tools we also design our levels using external tools as well namely tiled i honestly don't know any other level editors besides tiled if you do please let me know in the comments so i can try them out i really would like to compare them with tiled and see what the differences are so back on topic tiled is a level editor and you can see that i have it open right here now it's called tiled because you can import tile sheets and then interact with those different tiles from the sheet and use those tiles to draw up the design for your levels so for example right here i have just some test level that i'm using and let's say that i wanted to add like a little ridge a little bump in this level and i can do that by going down here to the bottom right where i have all of my tiles imported into this project and i can click on individual ones to draw up the layout for this level and i'm going to go ahead and do that real quick and there we go now our level has a little bit of a bump in the road and if i were to save this project and then export it now when i start the game we can see that the tiles that i drew into the map are now showing up in game but one thing that isn't immediately obvious is that these tiles that i drew don't have any physics attached to them so i can just like walk straight through it as if there's nothing there and this is just because i need to add an object to this set of tiles if we look in the upper right corner we can see all of our different layers and these pink purple ones are object layers there's a different layer for each type of object and one of them is called platforms this is my object layer that i keep all the physics for any of the ground anything that you can walk on so to add physics to this new set of tiles all i need to do is click on the platforms layer and then draw in a box right over top of it and going back to the game this set of tiles now has physics attached to it i can't walk through it and i can stand on it just like any other piece of ground now this works because i specifically placed this box in the platform's object layer and looking at the code whenever i go to load a new map or a new tiled map i'm going to go through every object layer and load in the appropriate object from that layer so for example the first thing i go through is the platforms layer which is the one that we just added to what's going on here is we have a for loop that's iterating through every object that was in the platform's layer from tiled and then for each one we're going to call the spawn platform function which just puts an invisible physics object into the game for a platform and you can see that we're passing it in the x and y coordinates for that box as well as its width and height so in the end the game is populated with a new physics box that again is invisible but it has the same dimensions of what i drew in to tiled and you'll see in this file that we're doing the same process for every object layer type or any type of object that i want to add to the game and some of these are more customizable than others like for example signs i can add a sign to the game which essentially is just a little sign that you can walk up to and read and it'll show a text box based on what that sign is supposed to display and here's the code for the sign object and you'll see that each sign accepts a position x and y as well as an id and what the id does is it determines what text to show when you go up and read it and in load map whenever we call spawn sign we pass it in the object layers x y as well as the object's name so to create a sign i just need to go to the signs object layer and then draw in a little box and in this name field up here i can type in something like how to jump now i chose the string how to jump because in my conversations file i have all the different series of text that the signs can show and one of them is conversations.how to jump so by putting the string how to jump in the name field it's going to load this conversation whenever you interact with the sign now in the game we can see that there's now a sign right where i placed it in the tiled map and i can walk up to it interact with it and now it's going to display the how to jump text and that generally covers how i go about implementing and designing levels whenever i'm using a framework rather than an engine and that'll do it for this video thank you so much for all the support as i experiment a little bit with these videos but i'm eager to start putting out more content please like the video if you enjoyed and be sure to subscribe if you'd like to see more game development videos thanks so much for watching and i'll see you in the next one
Info
Channel: Challacade
Views: 2,586
Rating: undefined out of 5
Keywords: game development, kyle schaub, love2d, lua, programming, levels, tiled, indie
Id: NgUTo5EISNY
Channel Id: undefined
Length: 6min 40sec (400 seconds)
Published: Thu Apr 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.