Introduction to Surfaces - GameMaker Tutorial

  Рет қаралды 9,909

DragoniteSpam

DragoniteSpam

Күн бұрын

Surfaces in GameMaker let you draw stuff indirectly, without it appearing on the screen. This may not sound too useful at first, but they open the door to a lot of graphical effects that wouldn't otherwise be possible later on down the line!
Also, who doesn't love implementing something like MS Paint?
Here's the code:
github.com/Dra...
drawing by Bakunetsu Kaito from the Noun Project
GameMaker 3D playlist:
• 3D in Game Maker Studio 2
GameMaker Studio 2 playlist:
• Game Maker Studio 2 - ...
#GameMaker
#GameMakerDrawing
#GameMakerSurfaces
- - - - -
I've now made that Patreon:
/ wizardragon
That promised social media link spam.
/ dragonitespam
Transition / idle music is by my old friend Kamex:
/ greatgabite
Rate, comment, subscribe, watch more, enjoy!

Пікірлер: 35
@karlstenator
@karlstenator 4 жыл бұрын
Thanks so much for this. I'm finally venturing into surfaces to create shadows, and this tutorial was perfect :)
@maxwellharris4493
@maxwellharris4493 2 жыл бұрын
Just working on fine tuning some stuff for mah game. Gotta say man. You just come off as incredibly chill and kind. Not to mention, your videos are so succinct and informative. I really hope the best for you. I'm feeling a big wave of appreciation as I finish watching this and head over to your other video on surfaces. Thanks for all your help!
@ilikecakeandbiscuits
@ilikecakeandbiscuits Жыл бұрын
My surfaces weren't drawing at all but I just used your script to check if they're active and they're working. Thank you so much! Almost makes the last 6 hours beating my head against a wall not so bad...
@prowokator
@prowokator 3 жыл бұрын
Important to note that surface will always excist in 0, 0 coordinate (the top left corner of the surface is there). You can draw the surface anywhere, but the surface will always be at 0, 0. So to draw something on to that surface you often have to move it first (or make it draw it's sprite there)
@Tempe_
@Tempe_ Жыл бұрын
Unless you draw it in a draw_gui event, in which case the x and y values in draw_surface will be relative to the window!
@GunnarClovis
@GunnarClovis 3 жыл бұрын
Excellent work with these videos! Surfaces are a great topic
@unvgames384
@unvgames384 4 жыл бұрын
Thanks for this, it's really interesting
@Mightyjordy
@Mightyjordy 3 жыл бұрын
This is fantastic! I would love to see a follow up if you can show how to create sprites and animate them from surfaces. That’s something I’ve been banging my head on a wall trying to figure out for a few weeks now
@DragoniteSpam
@DragoniteSpam 3 жыл бұрын
Wasn't planning on that, but it sounds like it might be interesting. I'll write it down as a future video idea!
@fierorecensione5828
@fierorecensione5828 9 ай бұрын
TOP!
@kindatim1798
@kindatim1798 2 жыл бұрын
Yo, you deserve alot more subs. Like, you have no dislikes on this entire video. Also, yo-yo games says "It is highly recommended that all surfaces be created with a size that is a power of 2, ie: 16, 128, 512 or 1024 pixels in size". Is it safe to make one 1080 or will it destroy my users device?
@DragoniteSpam
@DragoniteSpam 2 жыл бұрын
It's okay to make surfaces other sizes for normal drawing, it's mostly when you try to use them as a texture that you might run into issues with non-power-of-two surface dimensions, since GameMaker's internal texture pages (currently) are constrained to that size.
@GameJam230
@GameJam230 4 жыл бұрын
So I assume you could also draw a complete 3D camera to a surface too, right? If so, that may make the idea I had for 3D portals work a bit easier too... Ooh, I also took place in my first game jam (my username was picked before I knew what a game jam was XD) with a partner recently. There were some pretty bad bugs in the version we released, although we did make a pretty decent game. In my opinion, what we made in a week is better than one of my earlier games that took over 2 months to make.
@DragoniteSpam
@DragoniteSpam 4 жыл бұрын
I forget if I was having this conversation with you or someone else somewhere else, drawing a 3D camera onto a surface is definitely an option - though you might have to draw_clear_alpha first in order for anything to be visible.
@GameJam230
@GameJam230 4 жыл бұрын
@@DragoniteSpam We were talking at least a few weeks, if not months ago about non-euclidean space and portals in 3D, yeah.
@clayton_games
@clayton_games 4 ай бұрын
I'm not sure why, but using window_ mouse_get would draw the line next to my mouse instead of on it. I switch to simply mouse_x and mouse_y and it draws exactly where my mouse is.
@jaysanprogramming6818
@jaysanprogramming6818 4 жыл бұрын
What's the point of using window_mouse_get_x instead of mouse_x? I just checked the documentation and mouse_x is the position in the room and window_mouse_get_x is the position in the window. Does it change anything? I think maybe it would be important when using cameras but I'm not really sure. Could you give me good examples when to use one over the other and why? I love your channel. You're making quality content on GameMaker there. Keep it up.
@DragoniteSpam
@DragoniteSpam 4 жыл бұрын
If you're using views, mouse_x and y will still return the position of the mouse in the room - which won't necessarily have 0, 0 be in the upper-left of the window. Outside of 3D, if you want to use the mouse for UI things like clicking buttons or something, you should use the window functions; if you want to use the mouse for gameplay things like clicking on an NPC or a monster, you usually want mouse_x and y.
@nubemuffin
@nubemuffin 5 күн бұрын
Unrelated to your video, but I see you have Tiled on your taskbar. Why are you using Tiled when gamemaker has this kind of tilemap painting function already built in?
@DragoniteSpam
@DragoniteSpam 5 күн бұрын
tiled also does a bunch of stuff that gm doesn't do very well
@makeitsogames
@makeitsogames Жыл бұрын
Hey Michael. Is it possible to use surface draw copy but exclude a layer?
@TisDeKenny
@TisDeKenny 2 жыл бұрын
14:30 would've been a good end lmao
@DragoniteSpam
@DragoniteSpam 2 жыл бұрын
new goal: end every video by crashing my computer
@clayton_games
@clayton_games 4 ай бұрын
That would've been funny
@jaysanprogramming6818
@jaysanprogramming6818 4 жыл бұрын
Does every pixel of a surface comes fully transparent by default? I'm surprised the surface isn't showing as a black(?) rectangle without doing anything.
@DragoniteSpam
@DragoniteSpam 4 жыл бұрын
Yeah, when first created surfaces are essentially just a section in video memory full of zeros. Using draw_clear or draw_clear_alpha is useful for initializing a surface to a color.
@jaysanprogramming6818
@jaysanprogramming6818 4 жыл бұрын
@@DragoniteSpam I don't understand. From the documentation: manual.yoyogames.com/GameMaker_Language/GML_Reference/Drawing/Surfaces/surface_create.htm "When the surface is first created, it may contain "noise" as basically it is just an area of memory that is put aside for the purpose (and that memory may still contain information)" So how come it is transparent?
@DragoniteSpam
@DragoniteSpam 4 жыл бұрын
​@@jaysanprogramming6818 Apparently if the section of memory that was allocated for the surface previously contained data it may not be cleared when you create a new surface, but I've never actually seen it happen. It may be more likely to happen on integrated graphics or on a system that doesn't have a lot of video memory, like a mobile phone. Under most conditions it'll be black and fully transparent. You can check surfaces in the debugger to see what's on them when you create them.
@jaysanprogramming6818
@jaysanprogramming6818 4 жыл бұрын
@@DragoniteSpam OK, so for maximum compatibility it would be wise to make it fully transparent manually then? (with draw_clear_alpha(c_black, 0); I guess)
@DragoniteSpam
@DragoniteSpam 4 жыл бұрын
@@jaysanprogramming6818 Probably.
@AndrewOBannon
@AndrewOBannon 3 жыл бұрын
how to place two surfaces near each other and draw on both ?
@DragoniteSpam
@DragoniteSpam 3 жыл бұрын
At the same time? You can target multiple surfaces to draw onto with HLSL shaders.
@Cartoonicus
@Cartoonicus 3 жыл бұрын
Can this be done in D&D?
@DragoniteSpam
@DragoniteSpam 3 жыл бұрын
nope
@kedtealeaf
@kedtealeaf 2 жыл бұрын
It can be done. Use the Function Call D&D to input the lines of code. Set the first line in the Function box, then the ( ) in the argument box. Example: Function: draw_circle Argument: mouse_x, mouse_y ,8 ,false
Fake Shadows - 3D Games in GameMaker
11:54
DragoniteSpam
Рет қаралды 2,1 М.
Introduction to Buffers - GameMaker Tutorial
21:18
DragoniteSpam
Рет қаралды 4,8 М.
Новый уровень твоей сосиски
00:33
Кушать Хочу
Рет қаралды 4,3 МЛН
From Small To Giant Pop Corn #katebrush #funny #shorts
00:17
Kate Brush
Рет қаралды 40 МЛН
[GameMaker] Cameras, Views, and GUI
46:28
Badwrong
Рет қаралды 5 М.
Colors and Surfaces and Buffers - GameMaker Tutorial
23:46
DragoniteSpam
Рет қаралды 1,3 М.
Blend Modes & Silhouettes | Game Maker Studio 2
31:52
FriendlyCosmonaut
Рет қаралды 35 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 713 М.
How I Do It: Smart Clickable GUI
17:22
PixelatedPope
Рет қаралды 26 М.
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
Flowing Water Shaders - GameMaker Tutorial
25:01
DragoniteSpam
Рет қаралды 7 М.
Ultra-Fast 2D Dynamic Lights in GameMaker Studio 2 - PART 1
36:45
GrizzliusMaximus Games
Рет қаралды 23 М.
Shadows Tutorial: Game Maker Studio 2
28:34
FriendlyCosmonaut
Рет қаралды 36 М.
Advanced Blend Modes - Multiplicative Blending (and more) in GameMaker
18:57