GMS2 Cameras: As Simple as Possible

  Рет қаралды 63,984

PixelatedPope

PixelatedPope

5 жыл бұрын

Hey GameMakers!
Confused by GMS2 cameras? My previous tutorial didn't help much, but this one should set you straight. Let me know what you think of this type of tutorial, especially the white board feature!
--------------------------------------------
Links!
Join My Discord: / discord
Listen to obj_podcast: objpodcast.com/
Support me on Patreon! / pixelatedpope
Follow me on twitter / pixelated_pope
--------------------------------------------
Credits!
In Game Art created by GrogDev: / grogdev
BGM: The Origin by Legna Zeg
• No Copyright Chiptune ...
♪-Official▶www.legnazeg.com
♪-Twitter▶ / legnazeg
♪-Facebook▶ / legnazeg
♪-Instagram▶ / legnazeg
♫-Legna tracks and songs:
♪-bandcamp▶ legnazeg.bandcamp.com/releases
♪-Soundcloud▶ / legnazeg
♪-iTunes▶smarturl.it/AudioSuction
Camera Icon made by "Roy and Co" from FlatIcon.com www.flaticon.com/authors/roy-...

Пікірлер: 351
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Here's the code I use in my create event when using the aspect ratio management stuff. /// @description #macro cam view_camera[0] #macro view_w camera_get_view_width(view_camera[0]) #macro view_h camera_get_view_height(view_camera[0]) aspect_ratio = display_get_width()/display_get_height(); view_height= 250; view_width=round(view_height*aspect_ratio); if(view_width & 1) view_width++; if(view_height & 1) view_height++; max_window_scale = min(floor(display_get_width()/view_width),floor(display_get_height()/view_height)); if(view_height * max_window_scale == display_get_height()) max_window_scale--; window_scale = max_window_scale; window_set_size(view_width*window_scale,view_height*window_scale); alarm[0]=1; surface_resize(application_surface,view_width*window_scale,view_height*window_scale);
@realistindenial
@realistindenial 5 жыл бұрын
I found your series on aspect ratios extremely helpful and happily subscribed to your channel--thank you! I have quick question regarding GMS2. Which script is the most current for GMS2: the script here or the one in pastebin.com (referenced in one of your older videos)? I assume the one here, but just wanted to confirm. Thanks again!
@PixelatedPope
@PixelatedPope 5 жыл бұрын
@@realistindenial Everything I personally do with GMS2 cameras is based off of this video (and then I mix in some of the aspect ratio and pixel perfect scaling stuff from the older videos). If you have any more questions, definitely join my Discord server. I or someone else will be able to personally answer any questions you might have. discord.gg/By6u9pC
@realistindenial
@realistindenial 5 жыл бұрын
@@PixelatedPope Thanks for your response. Thanks for the invite to Discord. I'll see you there! :-D
@ulascantepe1326
@ulascantepe1326 4 жыл бұрын
Why are you making those macros? I don't see them being used anywhere in the code.
@PixelatedPope
@PixelatedPope 4 жыл бұрын
@@ulascantepe1326 it's more likely you'll use them elsewhere in your code. It's just a nice way to get the view's current dimensions.
@bamb00zld
@bamb00zld 5 жыл бұрын
Finally, a GMS video that isn't 2 years old.
@paradoxwjs5578
@paradoxwjs5578 4 жыл бұрын
Nice
@ameteuraspirant
@ameteuraspirant 4 жыл бұрын
it is now.
@digitalfantasies4570
@digitalfantasies4570 3 жыл бұрын
Oof
@RKCYOUTH
@RKCYOUTH 3 жыл бұрын
HAH!
@realcarlspartacus
@realcarlspartacus 3 жыл бұрын
hummm now is exactely 2 years old . But I don't care, I need it
@rockerhelgeson
@rockerhelgeson 5 жыл бұрын
I'm about to binge watch everything you put out. Thank you for this stuff, it is so helpful, can't say it enough! You rock man.
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Thank you!
@megabytegames
@megabytegames Жыл бұрын
Thank you for posting this! The simplified and persistent camera object really helps. I was having trouble letting the user adjust the window size and was led here. I used your simple camera setup and added a 'surface_resize(application_surface,camera_view_width,camera_view_height)' whenever the window changes size, or when the room changes, and it seems to work well so far.
@megasupernewbie
@megasupernewbie 5 жыл бұрын
Hey, I just wanted to thank you for all your videos. It helps immensely in learning game maker :)
@thimblebirb
@thimblebirb 5 жыл бұрын
Great video for beginners, especially with you using the whiteboard to visually show what's happening behind the scenes.
@nathanconstable4633
@nathanconstable4633 5 жыл бұрын
It’s so nice to see how fast you help people on discord
@gabrielmourao2854
@gabrielmourao2854 4 жыл бұрын
yup 100% recommend it
@WangleLine
@WangleLine 2 жыл бұрын
This!! He's a really cool guy
@ironworksentertainmentstud2493
@ironworksentertainmentstud2493 2 жыл бұрын
Thank you so much!! I have watch several other videos on views and non of them explained it well and I was getting frustrated until I found your video, You explain it so well I will be watching more of your videos from now on
@kwishy6902
@kwishy6902 5 жыл бұрын
THANK YOU! The camera function in gms2 is such a mess to understand for someone like me and I didn't know how to simplify it. It's good to know what I should avoid doing to avoid bad habits. That's a very informative video, you're awesome!
@moosemeep3694
@moosemeep3694 3 жыл бұрын
Thanks so much, this was really helpful. Especially with the stuff about how the camera always follows the top left of the player. It was really confusing before, but it was understandable the way you showed it.
@chegmj
@chegmj Жыл бұрын
thank you so much for this!! clear, concise, easy to understand, definitely the best tutorial on basic gamemaker cameras
@NoLootStudios
@NoLootStudios Жыл бұрын
Thanks a lot, man! That little extra explanation there about the view compared to the "room" was very helpful knowledge! Thanks! Subbed!
@nathanag362
@nathanag362 2 жыл бұрын
The scaling problem has been causing a headache for me and this video solved it. Thank you very much!
@Impscraft
@Impscraft 4 жыл бұрын
Wow, this video was fantastic. It was simple and straight to the point. Helped a ton, thanks!
@jarirepo1172
@jarirepo1172 5 ай бұрын
At the time when I start thinking of all of this stuff this video is a best thing I could ever find. Thank you, it would have taken me unthinkable amount of time to figure all this out on my own.
@jarirepo1172
@jarirepo1172 5 ай бұрын
All right, basic setup seems to work, camera follows at the center of my player, all fine, except the sprite of the player moves in totally different speed, not staying in the position of the player. What's up with that? Actually sprite is already drawn in a different location when I start the game, weird. Position should be absolute I think, why is it offset by that much? If I take out the camera code everything works as it should, something makes my sprite drawn in wrong place. EDIT: I found it, I had draw_self() function at draw GUI... which apparently is wrong choice. :D
@rcrrcr4552
@rcrrcr4552 2 жыл бұрын
I have watched this video 15 times, every time I start a new project. You are a savior.
@PixelatedPope
@PixelatedPope 2 жыл бұрын
Just between you and me, I have to watch it every time I start a new project.
@patriciaduffy2479
@patriciaduffy2479 2 жыл бұрын
Great tutorial! Thanks for helping! Whiteboard was nice touch
@paullishchynskyi6442
@paullishchynskyi6442 5 жыл бұрын
Awesome! Fixed all the jittery pixels for me, as well as answered a couple of other questions. Thank you so much!
@chef2654
@chef2654 5 жыл бұрын
Nice dude, been waiting for this :)
@chet_awesomelad
@chet_awesomelad 3 жыл бұрын
God fucking bless you, PixelatedPope. Your tutorials are an absolute LIFESAVER. Cannot thank you enough for this!
@Nekuvsnoise
@Nekuvsnoise 4 жыл бұрын
i've been dying for videos like this!
@johnroberts8088
@johnroberts8088 5 жыл бұрын
Best video on the subject ever!!!!!
@steviegillen82
@steviegillen82 5 жыл бұрын
Yoyo Games should be paying you for your content. Top notch as usual
@Heesmaster
@Heesmaster Ай бұрын
Thanks for showing me this video, very nice!
@mallen1846
@mallen1846 5 жыл бұрын
Simple but clear and concise 👍
@hoodedwizard
@hoodedwizard Жыл бұрын
This was awesome! Love it. Thank you very much.
@WorldIsNotMine
@WorldIsNotMine 5 жыл бұрын
i'm a subscriber. you uploaded videos recently. i want more your many tips. by the way have a nice christmas.
@Picklesushinoobface
@Picklesushinoobface 5 жыл бұрын
Definitely going to use this!
@Isseinoyuu
@Isseinoyuu 5 жыл бұрын
Hey, thanks a lot for this, this is exactly what I was looking for. I like to make traditional style games with strict resolutions / pixel grids. By using surface_resize to set the application surface size to the view size it enforces a strict limit. What I had to do before was floor any x and y values that weren't integers before drawing, but this simplifies things. The only downside I've found so far is that I usually print some debug information to screen, but now that's forced to the same resolution limits as well so it takes up a lot more screen space than before. It's also a lot easier to adjust the camera position this way than wrestling with the auto-follow in the room editor.
@PixelatedPope
@PixelatedPope 5 жыл бұрын
So, if you output debug information to the gui layer, you can resize the gui layer using display_set_gui_size(), and you can set it to the same size as your window! Then you debug text will be super small and crisp.
@Isseinoyuu
@Isseinoyuu 5 жыл бұрын
@@PixelatedPope hey, thanks! I'll try that. The solution I found was to create a custom font with aa turned off and make it as small as possible. It works and I like the fact that it doesn't break the pixel density, but screen real estate can still be an issue.
@aaronpillert5874
@aaronpillert5874 4 жыл бұрын
You, sir, are a scholar and a saint! Thank you!
@andresgrimminck8674
@andresgrimminck8674 5 жыл бұрын
That's a great tutorial!! Thanks!
@laserlemons1577
@laserlemons1577 5 жыл бұрын
This makes much more sense than any other tutorial I've seen about cameras, thanks! Now it's time for me to go back and rip out all my old camera code...
@torbacz2335
@torbacz2335 4 ай бұрын
finnaly a video that explains everything perfectly
@magnomaol
@magnomaol 4 жыл бұрын
Following the tutorial I had pixel distortion but because I was working with a very small resolution,240x135 (1920/8 x 1080/8) since my characters are 16x16. When setting up for the camera to follow the player we have "var _y = obj_player.y - view_height/2" at 8:55. Since in my case the view_height==135, my camera "y" coordinate was always in a fraction position. So I just used floor() there("var _y = obj_player.y - floor(view_height/2)"), and whenever I used "view_height/2"and everything is ok :). Also my app surface was the size of the view(very small, 240x135), if I set it to be the size of the game window(6x bigger) it would hide this bug. tl:dr I had pixel distortion because I was accidentally setting up my camera to be in a fractional position, make sure you don't do that =)
@boxedgamedev9462
@boxedgamedev9462 2 жыл бұрын
was super helpfull I was able to make an infinit room in a fullscreen window (also added some camera movment code myself) much more customizable than the settings in the room editor
@H0JuSan
@H0JuSan Жыл бұрын
Cheers mate, you're a legend
@simonbooth4888
@simonbooth4888 2 жыл бұрын
I've been playing with Level Of Detail for sprites which works nicely with responsive screen layouts. Basically if your art is rendered rather than drawn it's easy to render out at power of two scales with transparency maintaining detail and ketting really good results even with 1.5x scaling as you have something close to it available. I'm going to try this approach using MipMaps for tiles that don't need transparency - constructing the images out of RGB should be fun...
@betatester03
@betatester03 5 жыл бұрын
Concise and insightful, as usual. Love the whiteboard. What software were you using for that? That could be pretty helpful when creating class follow-up videos for my students.
@PixelatedPope
@PixelatedPope 5 жыл бұрын
It's a bit of a cludge :D It's a drawing app called Leonardo running on my Surface Book 1. I then used Chrome Remote Desktop to show the Surface on my desktop.
@allindoge
@allindoge Жыл бұрын
legend, thanks this really helps.
@NeZversSounds
@NeZversSounds 5 жыл бұрын
It's for sure way easier. Now I can simplify my setup.
@ilikecakeandbiscuits
@ilikecakeandbiscuits Жыл бұрын
So bloody useful!
@super_bits
@super_bits 2 жыл бұрын
Niceeee! Need more video tutorial!!
@lloyd011721
@lloyd011721 3 ай бұрын
this video is super helpful
@graydaydinya9383
@graydaydinya9383 Жыл бұрын
thank you so much, man
@cjtodd6244
@cjtodd6244 3 жыл бұрын
THANK YOU SO MUCH I LOVE YOU
@KormVerde
@KormVerde 2 жыл бұрын
Oh my god, you just saved my project. Thank you very much for the info about cameras cus I couldn't find anything helpful in the documents.
@randokaratajev2617
@randokaratajev2617 3 жыл бұрын
Jesus man. I'm so grateful for your tutorials. I've dropped my project for months because I couldn't understand why some tiles were stretched during camera movement. I haven't yet tried your dynamic scaling solution but once I get off from work, I'll try it out. I really hope this solves the problem. I still have one question tho: Is it possible to get an invite to your discord server and ask you or the other experts for advice if any errors or problems might occur. Do I need to pay for the help or how do you provide it? free if the time suits you? I'd be also glad to show you my not so impressive platform game in the progress.
@larryteslaspacexboringlawr739
@larryteslaspacexboringlawr739 5 жыл бұрын
thank you for gamemaker tutorial
@alexandervladimirov4365
@alexandervladimirov4365 2 жыл бұрын
thank you!
@killerkartoffl
@killerkartoffl Жыл бұрын
Very nice Video
@MagicPlayaFTW
@MagicPlayaFTW 5 жыл бұрын
0:35 is why I subscribed. I don't know if you intentionally subverted my expectations with that punchline, but damn, I thought he was going to say, "I'm interested in what game you're making." or something to that effect.
@LeonacYT
@LeonacYT 5 жыл бұрын
Thank you
@davidwillison6926
@davidwillison6926 5 жыл бұрын
Nice job explaining the new system. The one part of setting the view within the room editor that was missing is the concept of view border. I assume that if you wanted to include this aspect with your system, you would calculate it manually rather then using the built-in functions (camera_set_view_border)?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Right. Basically, you take full control over the logic of your camera, so if you only want the camera to move when the object is close to the edge, you can handle that with logic.
@squidman3113
@squidman3113 5 жыл бұрын
Hey thanks for the tut, I've got a small problem though, while the camera works and follows the player, it doesn't do that slow drag back to the center of the screen for the player character. Did you maybe change something in the other parts of the camera events and not show it? Or am I just missing something?
@ThiagoJaqueta
@ThiagoJaqueta 5 жыл бұрын
4:20 - Just a quick heads-up, from my experience, a Low Res app surface will increase the performance on Low end GPUs (I'm talking about potatoes here, like the GT 710, HD 6450 and APUs). Add an option for the player if possible (Or just scale down if the Frametime is too High).
@ajinkyax
@ajinkyax 5 ай бұрын
wow this works even in 2023 GM version. thanks
@tyleranders9972
@tyleranders9972 5 жыл бұрын
Great stuff very informative and easy to understand
@mythitorium
@mythitorium 4 жыл бұрын
Finally, A religion that I can get on board with.
@hylt0n
@hylt0n 5 жыл бұрын
i love you
@hiddenname7232
@hiddenname7232 5 жыл бұрын
YES, thank you. I only want one view and I make a lot of different projects, and it gets frustrating to have to figure how the hell I have to set my camera up again EVERY time. So many features I don't need. (They're nice... on that rare occasions you want to use them but...) Why can't they just have a simple 2d camera as another option?
@meh3643
@meh3643 3 жыл бұрын
finally a working code!
@DeadManRising36
@DeadManRising36 3 жыл бұрын
for those who cant seem to run the game even though the code is identical! In your End Step event of obj_Camera Do NOT put a ';' behind the line containing "#macro View view_camera[0]"
@PixelatedPope
@PixelatedPope 3 жыл бұрын
Yup. No semi colons on your macros!
@DeadManRising36
@DeadManRising36 3 жыл бұрын
@@PixelatedPope by the way what settings do I need in my game graphics options?
@PixelatedPope
@PixelatedPope 3 жыл бұрын
@@DeadManRising36 Default settings should be fine. Most important is the "Keep Aspect ratio" scaling option. Everything else can be changed as needed.
@mallen1846
@mallen1846 2 жыл бұрын
I would add, with newer version of GM2, placing macros in objects will raise an exception (at least it does in this example). Create a script file and place them all in there and it will then run error free.
@IRBenHunter
@IRBenHunter 4 жыл бұрын
This is great - one question out of curiosity: why do you start your var names with underscores (eg _x, _y, _spd). is this a common naming convention or just personal habit?
@PixelatedPope
@PixelatedPope 4 жыл бұрын
Both? Sometimes I tell myself I started the trend. It was more important back in GMS1 and earlier when variables didn't have different colors, but it's a good idea to differentiate your vars from your instance variables. And the easiest way to do that consistently and make it immediately recognizable at a glance is with some sort of special character. The other advantage is being able to reuse common variable names. For example, say you are looping through the rows and columns of a ds_grid with a for loop. Many would do something like this: for(var i=0; i
@IRBenHunter
@IRBenHunter 4 жыл бұрын
@@PixelatedPope thanks, great explanation!
@SonictheHedgehogInRealLife
@SonictheHedgehogInRealLife 4 жыл бұрын
This is a good video
@diddlenfiddle7311
@diddlenfiddle7311 4 жыл бұрын
So I've been getting really disheartend with the room editor's camera controls. Thank you soo much! I can carry on with my project now!
@PixelatedPope
@PixelatedPope 4 жыл бұрын
Nice! If you are ever feeling disheartened and want to commiserate with other GM users, make sure you join the Discord server! We'll help you get over whatever has ya down! discord.gg/By6u9pC
@diddlenfiddle7311
@diddlenfiddle7311 4 жыл бұрын
@@PixelatedPope I don't know why it took me so long to see this! Thank you again
@reubenmoloney4628
@reubenmoloney4628 2 жыл бұрын
There can be uses for two cameras without split-screen. Using the built in view-ports is a valid option.
@Squidmoto3
@Squidmoto3 2 жыл бұрын
no its not, you're horrible at programming
@jeffjensen2263
@jeffjensen2263 5 жыл бұрын
Been trying to mesh together your first one with this one, but would really love a completely fresh from scratch video based on GMS2. Also a bit confused as to some of the magic numbers, like view_width=1920/6 - you just say that the higher the division number, the better, but don't really go further into it. Any chance you would consider making something like the old part 3, but from scratch in GMS2?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Yeah, I've helped a few people with this exact thing. I could do a future video on that, sure, but who knows when I'll get around to that. For the time being, join my Discord server and ask there, and I or someone else familiar with the topic will help walk you through it and answer any questions you might have. discord.gg/By6u9pC
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Alternatively, you could check the pinned comment which is how I've personally meshed the old tutorial and this one. But feel free to reach out with any specific questions.
@teinimon2395
@teinimon2395 5 жыл бұрын
I see that when you start the game, the view moves from where it is positioned in the room (top right) to where the player is. I haven't tested this but to make the view start right at where the player is when you run the game, adding this code in the ROOM START event should do the job. if instance_exists(o_player) { x = o_player.x; y = o_player.y; }
@PixelatedPope
@PixelatedPope 5 жыл бұрын
You would need to duplicate the entire code of the end step event without the lerp and that would do it. view_enabled=true; view_visible[0]=true; if(instance_exists(obj_player)) { var _x = clamp(obj_player.x-view_width/2,0,room_width-view_width); var _y = clamp(obj_player.y-view_height/2,0,room_height-view_height); var _cur_x = camera_get_view_x(view); var _cur_y = camera_get_view_y(view); camera_set_view_pos(view,_x,_y); }
@teinimon2395
@teinimon2395 5 жыл бұрын
@@PixelatedPope Yeah, that works. Thanks for correcting. I should've tested that before commenting.
@MrKingJavo
@MrKingJavo 5 жыл бұрын
Love the work you're doing. Keep it up! Not sure about anyone else but I prefer no music on these tutorials. It's like playing music when in class trying to learn something. Just my 2 cents.
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Alright, thanks for the feedback! I'll continue to monitor opinions on this, and adjust future videos accordingly. Thanks for watching!
@chef2654
@chef2654 5 жыл бұрын
I agree with you, if you want a temporary fix tho,, Youn change your equalizer setting to boost vocals :)
@PixelatedPope
@PixelatedPope 5 жыл бұрын
@@chef2654 It doesn't help that my audio quality was ass in this video. Fortunately that will be fixed from now on!
@MsPinky1306
@MsPinky1306 3 жыл бұрын
nice
@KaziiTheAvali_inactive
@KaziiTheAvali_inactive 3 жыл бұрын
i love it however personally i would when room load set it where the player is in the middle aslong as its not on the edge (then i would have it clamped) to prevent it moving from top right to player smoothly
@PixelatedPope
@PixelatedPope 3 жыл бұрын
Yup! Great idea to snap to the player's position in the room start event. Or it can look cool to do it a bit above or below the player once you have a fade implemented, so it looks like it's just sliding into place as the fade completes.
@McDuders
@McDuders 3 жыл бұрын
how would you go about making the camera move only if the object is within the view's bounding box? I'm making a fighting game and I'm not sure if I can figure this out.
@samehat
@samehat 4 жыл бұрын
One question I didn't see answered: For this approach, I know we don't use room for viewports but... do you have Enable Viewports ON or OFF in the Room Editor? I assume OFF, but wanted to be certain since it's default ON... :)
@PixelatedPope
@PixelatedPope 4 жыл бұрын
Yup! You shouldn't have to set anything view related in the room editor ever with this method. The room start event checks that box for you.
@CopyCopyOriginal
@CopyCopyOriginal 3 жыл бұрын
ty for the content! when you say 'set zoom up here' what do you mean? I keep fiddling with this camera_set_view_size function to get the camera to zoom in on the player during certain events, but it doesn't focus the player.
@PixelatedPope
@PixelatedPope 3 жыл бұрын
Yeah, it can be a bit tricky. You need to change the size of the view to zoom in/out and THEN position the view. Because when we are positioning the view we are always moving the top left corner, if you center it on the player, then resize it to be smaller, your player will move down and to the right. So resize, then center. And you have to center based on the new size, not the original, so don't get the size, resize and then center based on the previous size.
@theeclipse8492
@theeclipse8492 Жыл бұрын
the velocity of the camera looks like the hotline Miami's camera XD
@InCognito-bc4ce
@InCognito-bc4ce Жыл бұрын
In search of a solution to the problem of pixel distortion, I found myself here, in front of your playlist. These guides were very useful for me, but I still have a question about views and cameras. Is it possible to add a mini-map for a 2D game with camera? If not, are there any alternative methods to manage game resolution and aspect ratio with such possibility? I'm quite unskilled at GMS.
@PixelatedPope
@PixelatedPope Жыл бұрын
It's absolutely possible, yes. KZbin comments aren't exactly the best way to get help with GameMaker, though. I highly recommend joinging the GameMaker Discord server and asking your question there. If I'm around, I'll help you myself. If I'm not, there are lots of friendly, helpful people there to answer questions. Here's a link: discord.gg/gamemaker
@drsquash2003
@drsquash2003 4 жыл бұрын
What would be the best way of implementing view scaling or 'fov' based off the camera's speed? (ie the faster the camera moves, the wider the fov becomes) I thought about just creating a muliplyer: var _fov = 1 + (point_distance(_x, _y, _cur_x, _cur_y) * .1 Then applying that to the: camera_set_view_size(view, view_width * _fov, view_height * _fov) But as you stated, the view size needs to be established prior to calculating it's coordinates, soooo...
@PixelatedPope
@PixelatedPope 4 жыл бұрын
Yeah, changing the size of the view at any time immediately complicates things. I usually operate on a "base" size and scale things off of that. So instead of referencing the current view size to get your view_width and height, you would have a static variable that represents your base size.
@drsquash2003
@drsquash2003 4 жыл бұрын
@@PixelatedPope Hi again. Thanks for taking the time. I'm getting a strange "overlapping effect" with collisions. If I remove the camera from the room, and test collisions, they appear pixel perfect. I am using subpixel movement, and using this code: // Check for collisions and move player if(place_meeting(x + move_speed, y, obj_solid)) { x = round(x); repeat(ceil(abs(move_speed))) { if(!place_meeting(x + sign(move_speed), y, obj_solid)) x += sign(move_speed); else break; } } else x += move_speed; I snagged this code from a forum, and it seemed to work, up until implementing the camera. Just to clarify. Collisions are functioning normally. It's just the appearance that is off. Side note: I raised the window_scale to 16, as it drastically improved the smoothness of the camera
@GradoniusTheWise
@GradoniusTheWise 3 жыл бұрын
Thank you for your videos! I have once used two views for a single-player game and I am curious if you can share why I am wrong as it seemed correct at the time. This was back before GMS by the way. I used one view to follow the character and then a second view layered on top of that but in the bottom right corner as a mini-map / radar. This seemed like a pretty good use case for 2 views on a single-player game but let me know!
@PixelatedPope
@PixelatedPope 3 жыл бұрын
Absolutely! It "seems" like a good idea, but it's actually terrible! When you have a second view, every single object in that room runs its draw event for that view. Every. Single. One. I imagine not a single thing visible in your first view was meant to be seen in your second view. Or at least, a very limited number of them. But since you used a second view, EVERY object lined up to run their draw event again. Not to mention other non-object related drawing like all of your backgrounds and tiles. Everything draws for every view. I don't think I need to explain why this can be very bad. Radars and minimaps can be easily created using a surface, and then you have full control over what is drawn to that surface. This will be much better for performance and it's way easier to manage than positioning views in a room.
@GradoniusTheWise
@GradoniusTheWise 3 жыл бұрын
@@PixelatedPope Thank you for the good insight! I am still new to utilizing surfaces but I am looking forward to explore them.
@MANNLIERMANNCO
@MANNLIERMANNCO 5 жыл бұрын
Hi, um first of all, im a huge fan and i don't know what i would've done without your aspect ratio videos haha. I followed this tutorial and my one concern is that when the game starts it sort of expands into the window for a split second, as if decompressing. I noticed it kinda happens in your example aswell, any ideas how to get around it?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Yup. Typically we start with a pure black screen and then "fade in" to your title screen or company logo, etc.
@MANNLIERMANNCO
@MANNLIERMANNCO 5 жыл бұрын
@@PixelatedPope Oh yeah, that makes sense hahaha. Thanks so much for the reply my man !
@MANNLIERMANNCO
@MANNLIERMANNCO 5 жыл бұрын
Hey!, i didn't wanna nag you anymore but i encountered a bit problem while playtesting. When on Fullscreen there's kind of a tearing on vertical movement, it's very subtle and it looks kind of like static on an old tv. It appears to not happen when zooming in or manually resizing, so an easy fix outta be to just avoid fullscreen. May be an unique problem to my setup, but i'm following pretty much all your tutorials regarding aspect ratio and cameras so i dunno if it's a recurring problem amongst other people. It's very much minor so feel free to dismiss this haha! thanks!
@ShaolinMonkster
@ShaolinMonkster 4 жыл бұрын
thanks , some fresh tutorials. Subscribed and liked
@ignaciosb8779
@ignaciosb8779 5 жыл бұрын
4:41 I like the goal a lot. I have a doubt though.. making the camera_obj persistent will not cause any conflict in menu screens? For example the main menu screen before starting a game. I mean, I guess the view settings will have the same values for every room. So, in static menu screens where I want everything to be visible at once.. should I make sure that the size of the whole menu fit with the view height and width..?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Yup! Your menu screens should use the size of your view if they are full screen.
@ignaciosb8779
@ignaciosb8779 5 жыл бұрын
@@PixelatedPope Thanks.
@ocoro174
@ocoro174 4 жыл бұрын
is there ANY way to fix jittery camera caused by parallax? especially noticeable when the camera is moving slow
@0x44_
@0x44_ 2 жыл бұрын
Any chance of making a split screen camera video that scales? Not too many resources on the subject.
@MetalJoshi156
@MetalJoshi156 27 күн бұрын
*ME LIKE A COMPLETE DUMBASS, MISSING THAT ONE SMALL WARNING IN THE BEGINNING* ("Don't use the room settings.") Thank you, thank you, THANK YOU. The scrolling is now completely smooth as butter, at all possible refresh rates without animations breaking. To anyone rolling their eyes at my mistake, yes I'm a complete idiot. But small oversights like my one could happen to *you* as well for another silly reason. Be VERY careful!
@lksxxtodin5292
@lksxxtodin5292 Жыл бұрын
These tutorials are amazing! Why did you stop making videos?
@PixelatedPope
@PixelatedPope Жыл бұрын
They take a lot of time and energy 😅
@arandomgal7814
@arandomgal7814 2 жыл бұрын
Hey, is there a way to vertically flip the camera?
@yourjourney.
@yourjourney. 4 жыл бұрын
I fucking love you
@slickygreasegames
@slickygreasegames 3 жыл бұрын
I loved this tutorial and I know its going to help me a ton. I was using another camera system before, but I find this one to be more useful. I do have a question through. For some reason , when i play my game my camera zooms in to my character a bit too much( i think it is because I have the width at 1920/6 and height at 1080/6 in the create event. Is there someway i can fix this because you said the higher the number, the better it is going to look but I do not want the camera to zoom in too much.
@PixelatedPope
@PixelatedPope 3 жыл бұрын
Yeah, just go down to 5! The higher the better but not at the cost of how you want your game to look. If it's too close, just step it back. I wouldn't go below 3... but 2 is technically okay as well if you are okay with your game looking absolutely awful on old laptops.
@slickygreasegames
@slickygreasegames 3 жыл бұрын
@@PixelatedPope Another question, how about the aspect ratio, so the pixels will look nice and clean (I'm using hand drawn sprites). I was wondering how that would be set up with this system. I saw your other tutorials about aspect ratio, but I don't know which code to put in. And one more question, this may be a dumb one but on the left where you can change the size of the screen in the room, with this code I won't have to do that anymore?
@PixelatedPope
@PixelatedPope 3 жыл бұрын
@@slickygreasegames Yup, don't mess with the camera / view settings in the room editor anymore. This code does all that for you. As for aspect ratios, I would recommend not worrying about them. You don't need to support ultra wide screen, or 16:10 or whatever. Just support 16:9 and be okay with some black bars. Nobody is going to care, and it's really not worth the effort for 99% of GM projects.
@slickygreasegames
@slickygreasegames 3 жыл бұрын
@@PixelatedPope One more question. Since my camera zooms in on the character with those settings I have, would I need to shrink the size of the sprites and the background assets to fit with the room?
@PixelatedPope
@PixelatedPope 3 жыл бұрын
@@slickygreasegames Not necessarily. You can always increase the size of the view. You also mentioned "hand drawn" sprites... if you aren't doing "pixel art" with hard edges and precise pixels... well, almost none of this matters. You can make your view almost any size you want, including 1920x1080 if your sprites are just that large.
@Zedrocksaa
@Zedrocksaa 2 жыл бұрын
god bless
@sar9565
@sar9565 4 жыл бұрын
@PixelatedPope I have tried a lot with the camera most of them works with my game, but there is one main problem (which happens every time) whenever I add or do something with the camera the same obj moves in a weird way, like the sprite is moving , can you help?
@PixelatedPope
@PixelatedPope 4 жыл бұрын
I can probably help with that. Join my Discord server and I or some other member of the server will try to assist. discord.gg/By6u9pC
@ethanc2377
@ethanc2377 Жыл бұрын
Is there a way to make the camera positioned in the middle of two objects? I can't seem to figure that out.
@PixelatedPope
@PixelatedPope Жыл бұрын
Sure. Just 2 is pretty easy. Just find the midpoint between the two objects using the midpoint formula. Then point your camera at that the same way you would point it at one object. If you need more help beyond that, recommend joining the GM Discord Server here: discord.gg/gamemaker
@roastedzerg
@roastedzerg 4 жыл бұрын
You mentioned split screen, how would you go about making a split screen using the new gms2 cameras? Im only finding old solutions pre-gms2 that don't seem to work anymore. The old way isnt working for me and no matter what port size i do, the camera goes fullscreen. Thank you
@PixelatedPope
@PixelatedPope 4 жыл бұрын
I'm honestly not sure. I haven't even attempted it in GMS2, yet. I imagine you'd need to hook up a camera to the second view, and then manipulate the port variables to position and size them to both fit on screen.
@RoyalGuardians
@RoyalGuardians 4 жыл бұрын
Hey pope, i know it's a little bit later, but there's anyway to make my camera no shivering? that's because my player_speed are 1, and i've read that view x and y can't be a cracked number, liker 0.50 or 1.50, my player movements cut hspd and vspd in half in diagonals, so, when i move, my player just don't stop shivering, and if i try to floor, the player stops shivering, but the scenario, start to get a little bit unfocused, sorry for my bad english c-c
@PixelatedPope
@PixelatedPope 4 жыл бұрын
View positions actually CAN be non-whole numbers. But the easiest way to fix this is to use sub-pixels. Resize your application surface to be the same size as your window, and you'll notice things should stop jittering.
@Isseinoyuu
@Isseinoyuu 5 жыл бұрын
I have a couple questions: Why do you update the camera view size every step? As far as I can tell you only need to do that once unless you're changing the view size dynamically. When I start my game there's a small graphical glitch where it displays a squashed frame before filling out the window. Did I do something wrong, is there a way to fix that, or is that just the way it has to work?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
That's the way it has to work. Typically you want the first frame of your game to just be black, and then fade into the next thing you want the player to see. Then nothing ugly will be on screen. As for updating the camera size... there's no reason not to. And if your game supports zooming in or out, then you wouldn't have to change much to support that with this setup. You are welcome to set the view size in the room start event when you enable the view and never touch it again if that's all you need for your project, though.
@Isseinoyuu
@Isseinoyuu 5 жыл бұрын
@@PixelatedPope thanks for the reply. What you suggested about starting on a black frame is what I ended up doing. It felt like I was missing something so it's good to know I wasn't.
@Stefan-bn4wh
@Stefan-bn4wh 5 жыл бұрын
Hi! Great tutorial! Thanks so much again! I could easily combine it with your display manager. The only thing that I couldn't solve is that the player is always jittering when camera "lerps" towards him at the end. Do you, by chance, have a solution for this issue? thx in advance. steve
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Are you using sub pixels? If not, that would be a quick way to fix it. If not... man, you get into some sketchy territory. Much discussion has been had about how to move the camera in a locked pixel grid without jittering... it's a definitely challenge.
@Stefan-bn4wh
@Stefan-bn4wh 5 жыл бұрын
@@PixelatedPope Do you mean by "are you using sub pixels?" that I round the x,y positions? No I don''t.
@PixelatedPope
@PixelatedPope 5 жыл бұрын
@@Stefan-bn4wh Is your application surface larger than your view size?
@Stefan-bn4wh
@Stefan-bn4wh 5 жыл бұрын
@@PixelatedPope No I don't think so. I use your display_manager & the simple as possible camera. So my application surface is exactly as large as my view size right? Should I change it? .... Oh acutally my the size of my view is ideal_width & ideal_height right? (So zoom-x times smaller)
@PixelatedPope
@PixelatedPope 5 жыл бұрын
@@Stefan-bn4wh Yeah, that would be the quickest way to smooth things out. Try setting your app surface to be 2 or 3 times the size of your view, depending on your base view size (but don't exceed the size of your window), and see if that helps smooth things out. If not, something else might be going on and I recommend hitting me up on Discord for further investigation.
@badwrong
@badwrong 5 жыл бұрын
I was wondering, why is camera_set_view_size called every step? Can it just be called if the resolution changes?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
Yup! I usually call it in the step event because a. it doesn't really "cost" anything significant. And b. if I decide to do zooming or something, I'll end up having to move it into the step event anyway.
@badwrong
@badwrong 5 жыл бұрын
@@PixelatedPope thanks! The part about "cost" was what I was also getting at. Now I'm fiddling around with getting stuff working with isometric view.
@SirBenjeh
@SirBenjeh 5 жыл бұрын
Could you make a tutorial on how to make a camera that follows more than one object on screen?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
That's not too difficult a problem, but I'd need more information. Would you want the view to stay centered on all objects? Would you want it to zoom in and out as they spread out or got closer together? Best to ask in the discord server and I can help you there.
@TheToxicHub
@TheToxicHub 4 жыл бұрын
Really loving this camera object, but I've been having a couple problems with it. Everything works great until needing to switch rooms, then the camera bugs out. Having the obj_camera be persistent doesn't fix anything, nor does creating a new obj_camera in the new room. I have no clue why this problem is occurring, but any tips would be incredibly helpful!
@PixelatedPope
@PixelatedPope 4 жыл бұрын
I would recommend joining the GM discord server and asking me there. KZbin comments aren't great for troubleshooting. discord.gg/By6u9pC
@flye5003
@flye5003 3 жыл бұрын
I got a black screen :/ anyone has a clue of what could have caused that?
@PixelatedPope
@PixelatedPope 3 жыл бұрын
Could be any number of things, but youtube comments aren't great for debugging. I recommend joining the GM Discord server. Many of the members there are very familiar with this camera solution and can help you figure it out. If I'm available, I'll help myself!
@alexkennedy4990
@alexkennedy4990 5 жыл бұрын
I don't doubt there's a reason, but can you explain why we shouldn't set up the view in the room editor?
@PixelatedPope
@PixelatedPope 5 жыл бұрын
How many rooms does your game have? Is it 1? Then go ahead and set up your view in the room editor. Is it 100? Using the room editor suddenly feels a bit tedious, no? But, hey you only have to do it once and then it's done. Until you decide you don't like your original resolution you chose. Now you get to go back through all 100 rooms again and fix it. There's nothing inherently "bad" about setting up your views in the room editor, but on larger projects it is impractical.
@alexkennedy4990
@alexkennedy4990 5 жыл бұрын
@@PixelatedPope I see, that makes sense. I thought it might be an inherent problem, similar to the problems with persistent rooms that you mentioned in another video. Thanks for the reply. Thanks for making the palette swapping thing on the marketplace too, by the way. Really useful for my project, there's no way I was figuring out that on my own.
@PixelatedPope
@PixelatedPope 5 жыл бұрын
@@alexkennedy4990 No problem! Thanks for watching and good luck with your project!
@alexkennedy4990
@alexkennedy4990 5 жыл бұрын
@@PixelatedPope Thanks!
Resolution and Aspect Ratio Management for Game Maker - Part 1
10:24
PixelatedPope
Рет қаралды 109 М.
The 15 Commandments of Game Maker
16:32
PixelatedPope
Рет қаралды 123 М.
Cute Barbie Gadget 🥰 #gadgets
01:00
FLIP FLOP Hacks
Рет қаралды 55 МЛН
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 65 МЛН
How I Learned to Create GAMES (No School Required)
9:47
Goodgis
Рет қаралды 562 М.
GameMaker Inventory with Structs | GMS 2.3+ New Features
7:48
GameMakerStation - Matharoo
Рет қаралды 22 М.
How I Do It: Smart Clickable GUI
17:22
PixelatedPope
Рет қаралды 26 М.
How to Make a Good 2D Camera
11:38
Game Maker's Toolkit
Рет қаралды 385 М.
Technique for Creating Beautiful Level Design
11:48
Pixel Architect
Рет қаралды 817 М.
The Application Surface - Advanced Drawing - GameMaker Tutorial
16:04
5 Useful Scripts for GameMaker Studio 2 (and 1!)
9:34
Shaun Spalding
Рет қаралды 98 М.
Godot Character Selection Tutorial - Choose Your Bogan!
9:07
Outback Nerd
Рет қаралды 2 М.
Creating An Ecosystem Simulation Game In 6 Months
16:28
Fun Master Ed
Рет қаралды 499 М.
Resolution and Aspect Ratio Management for Game Maker - Part 3
24:38
БРАВЛ СТАРС ВЗЛОМАЛИ?!
18:31
Поззи
Рет қаралды 523 М.
Қорқынышты Майнкрафт - 5 бөлім ✅
32:10