debug in GameMaker studio ( all methods explained )

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi i'm navidansa and this is i'm gonna show you how i debit my game in game maker so without any further ado let's begin so you can see i have this game that is called basic platform game example that is free on marketplace and you can download it for free and let's just run it first to show you what it is and this is our game okay so i want to show you how i debug my game the first method of debugging in game maker and i think the powerful one is show debug messages and i use it for like 99 percent of the debugging of my game so for that let's just show you uh how you can have that in an object so let's just create an object let's call it obg test in obg test i want to check the left press of our button global live press so wherever they click this event will be triggered so let's just get rid of this comment and here i want to know if it's triggered or not what what i can do i can just say show debug messages and in here just say clicked whatever string you want you can put in here so that's it show debug messages and the string so no let's just add it to our room add it wherever you want and now let's just check if it's working or not so whenever i click wherever i want there will be a log in here that says clicked that's the first thing that you can do with that but you can do a lot with this show debug message so let me show you let's say i want to show the x and y position of the most uh or the touch or whatever so i want to say x equal to mouse x and this mo 6 what it will do let's just hit a middle mouse on it at no in here and it will show you the return type of these mosaics it is a real so we can we can't use just these mosaics in here what we should do because we should put a string on this inside these parentheses so what we can do we can say string and like this and this string function convert this mosaics that is a real number to the string so it will show the x value so now let's just run it again and whenever we click let's say here it will show the x value of the most where the most is so let's just again click here click here click here and you can see it will show us that value just close it again another method that we can use to debug our app is show show message so in here when we use this of course we should put a string in here so clicked and now let's just run it and whenever we click it will create this pop-up in here and says clicked so that's another method that you can use to debug your app and like before that we did with this show debug messages to add to a string together you can do it in here sometimes you are in async event right and you want to debug in that you can't just use show message so what you should do you should say show message async and in here you can write whatever string you want let's say click and again run it and whenever we click it will show that in any async event you can use this show message async another way to debug your app is with using show error so in here you can for the first input you can say let's say clicked and for the abort you can say whether it should abort or not in here i want to say false and now let's just run it and whenever we click in here there will be an error in here and it will show you where it happened and it will show the message in here and it will show the line number that or error happen as well and the last function that i want to show you is show debug overlay and in here so set it to true and it will show the fps and all the uh variables in cpu and you see when i click wherever i want i can get the fps and all those information so you can see if you have fps drop or not there is another way to debug your app and it's a cool way all the uh id out there for programming for android's duo visual studio code and all of them has something similar so let me show you in here i wanna let's say in this o player in here on a step function i want to see some variable in runtime okay so i want to say what the value of h move in here what the value of h well in here i want to see all of those value values in runtime i don't want to use show debug messages because it will get messy so fast so how we can do that we can go to debug mode instead of just run your game you can debug it with f6 or just click on here now that we open it run or again with debugger i can go here and let's say i want to go to all player in a step function let's say i want to see all of these values when or whenever i want so for that i i should put a breakpoint here so i want to put a breakpoint in here and when the cpu is trying to trigger all all this line of code and it will reach here this background this line will be red and you can see the cpu are now here and no if i wanna see the value of h move i can hover over it and you can see the h move is zero i can see the moving speed that is five i can see the climbing speed and i can see all the variables value in here just by hovering over them you can watch all of this variable in another way if you go down here and you have a breakpoint in here you see you are at the step function of our o player so what it will show us in here in if we go to variables in this panel down here if if you don't have this variables panel here you go you can go to debugger when you are in debugger mode go to windows and you can enable locals global instances watch and all of these panels in here but if you close any of them you can just reset windows layout and all of them will be here by default so now that we put a breakpoint in here we can see all the variables in it so in variable panel here i can see all the local variable in this step function first is h move and second is h will in here and if you if you want to see od variable that is in create and in all dangerous uh collision here you can go to self and you can see moving speed you can see climbing speed and all of those variables that is local to this o player okay so these are the variables that we created but you know that there is some built-in variables so if you click in here in building variable you can see the id you can see the x and y of our player you can see the direction of our player you can see gravity that we set for this player gravity direction and all of those building variable you can see it over here in building by self dot building variables so that's the other thing that i wanted to show you next i want to show the global variables so in variables panel there is a globals in here so you can see there is three global variable here let's just create our own global variable close this debugger in here and let's just go to our obg test add a create event in here and say global dot my where is equal something like two okay so we create a global variable in here this warning is there for because we didn't use it anywhere so it will give us this warning in here so now let's just again go to debug mode to see if we can see this global variable here or not and you can see in the variable panel in my var the value is two so we can see the locals variable where the breakpoint is happening and we always we can see the global variable in here and there is another panel for watch so what this is for we can let's say we want to see the value of this edge move we can just copy it and paste it in here and we can see that the value of this h move in here of course you can see it in here as well but it it is it will get messy in here because maybe we want we want a lot of local variables and we just wanted this h move variable so we can put it on watch in here so we can see it separately from all of these variables the next thing that i want to show you is these instances okay so there is three panel in these instances first is the instance that we are in so we are the cpu are in this estate function of our op layer so it will show all the variables built-in variables in our o player in here but in the next panel you can see all the instances that we add to our room so you can see there is control there is obg test that we created before there is oh a spinner there is some osp near in or in our game and let's just run it and get rid of this um breakpoint again and run it again and know that we are on it let's just pause it and you can see there is some spinner in here there is some ladder there is some wall there is some door so you can see all of them in here there is some wall if you go down you can see the ladders you can see the walls the doors and all of them with their built-in variables or if they have local variable will be shown in here so next thing that i want to show you in this debug mode if you go to breakpoint in here you can see that in object control in alarm 0 line 4 there is a breakpoint so let's just find it in obg object control in alarm 0 line 4 there is a breakpoint of course we can disable that breakpoint from here or we can click in here so we get resolve that quickly next thing that i want to show you i want to show you how you can step through your codes so let's open one of our objects let's just say this ob oh player in here go to a step function of that and in here just add a breakpoint in here so it will stop here so if we hover over this climbing you can see that is checking if the climbing is false or true if it's false go through all of these code and if it's not false go through all of this code so if you hover over this it's zero it's like saying false and if you say a step over function call or f head f10 on your keyboard it will trigger one line of code so let's click on it and you can see because the climbing is zero and it is false it will go through this state so again we can click in here and it will run it line by line and you can see all the values in here and you can divide your code with this and it's so handy you can debug your game very easily with this if you want to know more about this kind of debugging just subscribe to my channel because i want to create a custom debug method for you so you can use that method to debug your app in runtime on your phone or your windows or your iphone no matter where you put it you can use that debug method that i show you i hope you liked this video it was useful for you if you want to help me please hit that like button and if you can share this video so everybody know about this thank you very much for watching bye you
Info
Channel: navidrct
Views: 58
Rating: undefined out of 5
Keywords: debug in GameMaker, debug mode in GameMaker, how to debug in GameMaker, debug our game in GameMaker, debug, debugging, advance debug, advance debug in GameMaker studio
Id: 7NSU0WF_6hs
Channel Id: undefined
Length: 17min 47sec (1067 seconds)
Published: Thu Dec 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.