I must thank you. There has past almost 2 years since I finished my school and my last test for my course was to make my project as my own (it could be a website, a regular program for windows, etc...) I choose to develop a 2D game in Visual Basic 2010. I search back in the day for something that would explain in depth how to develop a 2D game in VB until I found your videos. This was a great help to me, I did exactly the same program as you did in the videos, then after that I tweaked to fit more the way I wanted, I separated in 2 programs (the engine and the game itself). In the final of the year I needed to present my project to the teachers (in this test only few pass). I passed that test, I gave credits to you in the project to make my teachers look at your videos. I was thankful, but now I want to give thanks to you in the personal way, without you I couldn't made my course. Thanks again, keep doing this videos, this is worth to see :D
Thank you so much for that encouragement, Toshito! That is wonderful. I sometimes wonder if it's worth all of the trouble to make the videos, but then it's messages like yours that tell me "Yes!". :-) I'm very happy that my videos helped your project pass the test. :-D
Hey man, I've been doing VB for a couple semesters. I had a project that required me to make a game. I decided to try my hand at an rpg... but I didn't wanna use pictureboxes, cause i wanted smoother animations. A friend from class pointed me to this video, and I gotta say, you are a BRILLIANT teacher! I learned so much from watching these videos, and not only did I pass the assignment... but the teacher stopped me after class and asked me to demo my rpg to his class next semester. thanks again!
Man thank you! It's hard enough to find good videos on modern VB let alone game development because either they utilize the Timer control or they use a game engine like Raylib or Monogame. Not that I have anything against those game engines because I absolutely love them but I was looking for something that really peels back the layers and gets down to the basics especially in creating a frame counter system and using GDI+ which is exactly what I was looking for. This technique and information is timeless and is still relevant today so I appreciate you keeping these videos online and available for consumption. 😎
I'm glad these ancient videos are still finding some use. I'd wrestled with the idea of removing them or telling people, "Omigosh! Please don't use this to make a game!" 😆 Still, there are many good uses for GDI+ and since it's native to Windows, it still works today and without having to install a bunch of support packages or frameworks.
Hi Aardaerimus, just wanna say that your tutorials are a huge stimulance to making games. I had created a mod for Minecraft which was in Java, and now that they made a new update I nearly have to start from scratch. It was therefore I started looking for tutorials on making my own game. Yours open up a world of new ideas. Ive made your map run more smoothly (the map now scrolls per 10 px, instead of 50) and I added some Gui's. Thanks heaps for your tutorial. Unfortunately I suck at graphics...
This is a really great video tutorial. Very easy to understand and works perfectly. I'm working on a project and I chose vb to make a simple 2d game, and this video is a great help. I'd give it 10 thumbs up if I can
Yes, it's amazing what can be done in Visual Basic. For a long time the game development community has regarded VB as a bad language for game development, but I've always felt that it could be used effectively to produce classic style games. With the advent of XNA and the performance gains, the possibilities have grown immeasurably. :-D
@Aardaerimus lol, i put that there to mark my position in the video for when i return haha. Thanks for your vids man, you have proven to be a foremost teacher on these subjects.
Thanks, MrDuckBringer. :-) I hope you find what you're looking for. I highly recommend looking into some of the later tutorials, as well. They get better as they go, and XNA is so much more powerful than the GDI used in these old videos.
With Booleans, you don't need to add = True. You can just refernce the variable name and it returns true or false. So, Do While isRunning ' Do stuff here Loop is fine. It does exactly the same thing. Operators return true or false, too. So you can write more efficient code by using just a comparison with an operator. For example, Dim playerDead as Boolean Dim playerHP as Integer playerDead = (playerHP < 1) If playerDead then MsgBox("Ha ha! You suck!") End End If Here, the operator < returns true or false, and the = assigns it to the variable playerDead. You don't need the = True here in the If statement either. The variable itself returns true or false, satisfying the condition. Some people might like to write all this code out long hand for easier understanding, but it's always better to give the compiler fewer things to do.
if you use 'timeSetEvent()' and 'timeKillEvent()' you can create a timer class(i have 1, but only works with 1st instance :( )... so you can use 2 timers(1 for the Game Loop and the other for the Second) with much more performance ;)
Followed up your tutorial, made 2 layers for a sidescroller and its working at 20fps. I did some optimization: e.g. not render tiles when they are air, hide/show the inventory, hide/show the background details. GDI+ does not use the GPU AT ALL and it doesn't have hardware acceleration. You even included double-buffering, which is ferfect for flicker-less draw! Thanks! (i'm soon going to move to D2D btw)
You can just store the positions as points or separate variables and check it in the game loop, update sub, or at move time. If Pos.X > LeftEdge and Pos.X + 32 < RightEdge, etc. (If I'm understanding correctly)
thank you :-) It really is surprising what it's capable of now, especially with XNA. XNA blows the doors off of GDI in terms of graphical capabilities and performance. Every time I play with it I'm astounded.
I've been using this engine for months and I thought I'd give XNA a try since I've been teached libGDX, and when I saw the sprite batch and the graphics device manager I said 'It is similar, let's make a game with it!'.
DIM used to be used to specify arrays. Later on, it came to be used to declare all kinds of variables, when the possibility to specify the type for variables was added. Keep in mind, years ago, memory on some machines were limited to like 48KB... you had to be careful how you used it when you programmed, so DIM, short for DIMENSION, was used to set aside space for arrays
Thanks! You'll definitely be able to move things around with various methods once you learn the basics here. While this series is just an introduction and not "best practice", by the time you get through it you'll be able to move things around and you'll have a better idea of how things work so you can proceed on to better things. If at all possible, I recommend XNA over GDI, but this will still give you an idea of how things work.
@GTARockstarGamesVids There are a few different ways to toggle between the form and code screens: VIEW CODE: 1st - You can double-click your form to view your code. 2nd - From the menu bar (top), click VIEW --> CODE (F7) 3rd - Press F7 VIEW YOUR FORM: 1st - Double-click Form1.vb on the right, in the Solution Explorer panel. 2nd - From the menu bar (top), click VIEW --> DESIGNER (Shift+F7) 3rd - Shift+F7 Hope that helps. :-)
@jlt012 Usually, this means that the For X/Y loop is not propagating outward and downward properly and that all tiles are being drawn to the first square. Make certain that the destination rectangle is X * Tile size, Y * Tile size, the width is the tile size, and the height is the tile size. For example, in your drawing loop: (Using a tile size of 32) For X = 0 to 5 For Y = 0 to 5 dRect = new Rectangle(X * 32, Y * 32, 32, 32) G.DrawYourStuffHere(imagetodraw,dRect,sRect,etc...) Next Next
I believe that a game loop, over which you have a greater level of control, is generally considered "best practice". I can see how using the paint event might really help with GDI though. If it's only drawing when there's a form update, then you're not wasting resources with unnecessary draw cycles. :-)
Ah, forget what I said: after meticulously experimenting with your code, I found that you did use the backbuffer correctly, but you shouldn't have put the "G = Me.CreateGraphics" line before StartGameLoop since that will in fact draw the first frame on the form instead of the BB bitmap. That confused me. By deleting that line and putting "G = Graphics.FromImage(BB)" on the first line of DrawGraphics() (before drawing anything) you can fix it. Glad I finally understand!
The XNA framework is designed to take advantage of the graphics processing potential of your graphics hardware. Windows Forms and XNA are not mutually exclusive. The two can be used together, though I believe that it will be somewhat less efficient than pure XNA. Still there are times where combining the two can be very advantageous (A map editor app, for example).
@LandMuffin Usually this means that your drawing loop is not drawing out the proper distance. In the dRect you should be drawing something like X * TileSize and Y * TileSize for the width and height of the tile. The tile loop is is X = 0 to 19 and Y = 0 to 14 in this video (19:44). Follow this closely and you'll see that the rectangle is drawn at (X * 32) (Y * 32) so every time the loop steps through, the next number will move over 32 pixels and begin drawing the next square. :-D
Random mappers can be very tricky and complex. You can employ perlin noise and various other procedural generators, or you can make your own. I tried making my own map generator, though it worked, it was crude and hard to explain, so I didn't make a tutorial. The source is, however, available for download. The hard part in randomizing is making meaningful structures and connections between those structures. It can be done but takes a lot of planning and design. Inventory, I HOPE to do soon.
Hi there! That's the main problem with GDI, unfortunately. GDI does not actually utilize your graphics hardware, so the performance is significantly different for each CPU. If you have a chance, I'd strongly recommend using XNA over GDI. If you must use GDI, the best way to overcome the slow FPS is going to be by keeping your drawing screen very small. The fewer pixels it has to draw across the screen the faster it will go. To make it appear larger you adjust down the monitor resolution.
Great Thanks :DDDDD. You courses are exactly what I have needed and looked for! And this first one really works :). However, there is one little mistake from which I wish to inform other users. When You run the program, after that an error occurs for me at the definition BBG = Me.CreateGraphics(). If You remove the "Me.", it works correctly. Other alternative is to move the definition to INSIDE Form1 subprogram, after Your comment: "'Initialize graphics objects".
Really helpful with creating a View your FPS, for performance issues. plus if you don't a bug during testing it isn't a "Kewl" tutorial because most of us have one during a 1st Trial anyways.. Thanks for Sharing the wisdom.. :)
No sabia que se podia hacer juego en Visual Basic !!, ya que me gusta programar ahi. Quiero decirte tambien que entiendo tu idioma , I also speak inglish !!. Thank you broth !!
By far one of the best game tutorials out there. I want to take a second to thank you for the series of game design on visual basic. Also in the video you mentioned handling character movement which i could not find on your channel, maybe i am just blind, is there any chance you can give me a link to it? Ive done quite a few programs 1000 lines or less but id like to try this out to see if its for me before i get into a different program for design, so any tips you have would be great. Thanks:)
Probably one of the best programming tutorials ever! The only difference is my FPS and tick counter stayed at "0". Are you like a programming college professor? Lol
Thank you, very much! :-D For serious games, I highly recommend a graphical framework better suited for game programming (XNA, SFML, SDL, etc.) With XNA, I've seen FPS between 3000-8000. GDI is very unpredictable in terms of performance, from one machine to the next, due to its inability to utilize graphics hardware properly.
It sounds as thought you may be stuck in an infinite loop. Make sure you don't forget the "Application.DoEvents" inside of your endless loops, and add a way to stop the main loop. Something like an "IsRunning" variable that you can evaluate. :-) Do while IsRunning = True ... etc.
If you're interested, I did a "reboot" of my old DragonDrop game and it's much cleaner and more efficient than what I had in these old tutorials. While I still don't recommend using GDI for games with a lot of movement, it was a fun little project and is much cleaner and simpler than this tutorial code. I welcome you to download the project here: www.aardaerimus.com/sourceshare/gdiSource.asp
@T3RRABYT3 Ahhhh lol I had a feeling that it might be something like that. I know I goofed up in a few videos, and I was wondering if this was a pointer to one of those 'finer moments', but I checked at it seemed normal enough. heheh I appreciate ya stopping by, and thank you much for the encouraging word! :-D
hey thanks for the tutorials, they are awesome, i just wanted to say, so far at least the examples don't load in visual basic 2010 express, but they do work if you just copy and paste the code :) it seems I may have to obtain the full package to use this xna however
Hey man thanks very much for this tut,helped a lot to me.I have to do my graduate in programming section and i was given Direct3D and VB.net to do,with a little example like small game and thing,and i thing this will help me through...thanks again.
DIM - Declares a variable. EXAMPLE: Dim UserName As String = tbUserName.Text..... When declaring variables DIM is to be used inside a sub for use during that particular procedure PUBLIC can be used to hold a variable in memory for the duration of the applications runtime.
How to make game logic in one thread, and rendering in another? By the way, good tutorial for games without THAT many elements. I'm rendering the world, and inventory ONLY ONCE, to reuse in the loop, and I get 50-60 fps. Nice. Once the world is rendered, there's no need to re-render it again.
@Aardaerimus thanks for the nice answer my goal for this year/ next year is understanding a few things you did in this video and to understand the basics and maybe change something so i could change it from my own mind and in a way i understand. just the idea to creat a game which is working and to wich i can add some personal ideas and giving computer orders to make this work is huge for me even if its pong or a simple programm I could imagine for what you what did but i wouldnt be able to do
Some I compose on my keyboard. Some I make with a music mapping program. LMMS (Windows Version) - Linux MultiMedia Studio Audacity - Audio Recorder Also used ModPLug Tracker for a few.
@assassin132132 1.) Dim allocates memory space to a variable. Essentially, it's for creating a variable. Dim X as Integer = 2 creates a variable of an "Integer" type, and gives it a starting value of 2. 2.) Green words are comments. The compiler ignores them completely. They're used for making notes to yourself or others about what a particular section of code is used for - or anything else you want to comment about. To create a comment in you code simply start your line with a single quote '
@TheOrneryNerd I think what's happening is that the form is dumping drawing resources in the middle of its draw cycle, so it tries to draw with resources that no longer exist. The easiest way to overcome this is to put your drawing routine in a Try/Catch statement. That way it'll drop out in a friendly manner when the form is closed.
Yes, it can be done, however, even though VB.NET and VB6 are similar languages, there are many big differences - such as having to reference the GDI directly and using Bit Block Transfers (Blitting) for transparencies and whatnot.
For those who still follow this tutorial replace the line that assigns BB with this: 'BB = New Bitmap(resWidth, resHeight, Imaging.PixelFormat.Format32bppA)
@PcPlayer992 Hahah!! It's an ancient Dell keyboard that I salvaged because I really love the old clicky keyboards. When I'm at work I'll have to see what the model is. I have a few of them at work that I've saved for myself over the years. :-)
Hey Aardaerimus. I find your videos helpful in getting to know the new way of .NET programming; it's been a while since I last tried game programming in VB. So thanks for making these. However, there is a fundamental error with your backbuffer logic; you're essentially just drawing an invisible (unfilled) bitmap (BB) over the already drawn stuff on the form (from your G object). You didn't ever fill the backbuffer - look at your code, you'll see!
Hi there! What version are you on? I learned VB by just messing around and trying to solve simple problems at first. As I began to figure out how different objects worked together, I was then able to solve more difficult problems. The most important thing to do when learning any programming language is to have a goal. You need a direction to go as you test your capabilities. You start with the easy stuff, then as you hit road blocks you check Google for the problem to find how to overcome it.
@pheangsri It was provided by the company I work for, but I'm thinking we paid somewhere around $500 for it w/ the MSDN additions. The nice thing about it is that you can build deployment projects that take a lot of the work out of version control and creating an exe or msi setup package. Also, I think it has more database connectivity features.
I don't wanna download any toolkit because any other toolkit is extremely hard to use and, e.g OpenTK only knows about triangles. However I'd rather use OpenTK than GDI+. If there's a way to downgrade from GDI+ to GDI it would be cool! As i have seen on interner, here are comparisons: *300 elements D2D-55 FPS, GDI+-20fps,GDI-50fps,WPF-33fps *1000elements D2D-33fps,GDI+-5fps,GDI-40FPS,WPF-2fps
Great video! Can i ask how you got so good and fluent at vb? I'm just starting to try and create projects and I figured I would follow your tutorials until i can recreate something simple on my own. :D
Thanks, Harry! :-) Let me know if you have any VB questions that I can help with. You can also check out my VB Toolbox channel. It's geared more toward general VB and less toward game programming. The content there is a bit more fresh.
Hello, if for example somebody is running a game with this loop but has a slower machine... than will it effect the gameplay (for example a slower moving player at a slower framerate)? Thank you :-)
Not likely. To my knowledge, Excel uses VBA (Visual Basic for Applications) which is more of a macro language that is not compiled and is much more limited. It may be possible if VBA has access to Windows GDI, but I wouldn't count on it.
Thanks, man! That's awesome. Feel free to any of my code in your games, though you gotta keep in mind that these are just very elementary approaches that should be refined dramatically before being employed in the real game dev world. ;-) I'm constantly learning new things and revising my approach. Then I come back and look at my old videos and go, "What was I thinking?!" lol Isometric tiling... Whew now there's a worrisome beast. haha Yeah, I'd love to learn that myself.
Hey I liked your tutorial and where it was going. I had problems with getting DrawGraphics to work. I have no idea what the problem might be. I made a video response with a little bit more detail.
the coordinates for the rectangle should be the for loops variables for X & Y * 32 Umm for the ticks maybe you didnt set it to equal the Maxtick every time the second would finish? check all these.
So here's a question I've been wondering about. What is the key difference between just a regular VB Forms Application game and an XNA windows game? I understand XNA is for more game development, but don't really understand the difference between the two.
Great tutorials, but I have a question on backbuffer. Does "G = Graphics.FromImage(BB)" always put the blank bitmap into G? Does BB EVER have anything other than a blank image? So is put of our look to always put a blank image in G, just to clear it later? I thought a copy of the screen somehow goes into BB at some point, but I just don't see it. Can someone explain this? I am just not seeing it in the code.
Hello, I'm currently doing VB in my Computing GCSE. I was wondering if there was any beginner guides you've made to VB? I know simple things, text boxes, save & load information, pick random numbers. Would love to make a game in my spare time to help reinforce my knowledge and also to get higher marks. Any help would be appreciated, thanks! :)
I do not, sorry. These ancient projects were all on my old server, though I think I might still have a handful archived somewhere. Dragon Drop 3 was the best simple GDI game project, unless you're specifically interested in the tile mapping.
Thanks a lot! These are excellent tutorials! For this video, I was wondering why BBG doesn't have to be cleared like G does even though both draw something. Wouldn't BBG keep drawing over every previous image?
Digging around and chatting with people who are better than me. heheh Best way to learn! :-D These are pretty old, though. You might wish to check out some of the XNA stuff - though even that is getting old, sadly. :-( I really need to update.
Aardaerimus D'Aritonyss Sadly Microsoft gave up XNA but there is a way to download XNA for Visual Studio 2012 is called XNA 4.0 (refresh) if you google that you'll find it! I may check out your XNA tutorials too but I wanted to ask you if you can make XNA Platformer tutorials too?
I must thank you. There has past almost 2 years since I finished my school and my last test for my course was to make my project as my own (it could be a website, a regular program for windows, etc...) I choose to develop a 2D game in Visual Basic 2010. I search back in the day for something that would explain in depth how to develop a 2D game in VB until I found your videos. This was a great help to me, I did exactly the same program as you did in the videos, then after that I tweaked to fit more the way I wanted, I separated in 2 programs (the engine and the game itself). In the final of the year I needed to present my project to the teachers (in this test only few pass). I passed that test, I gave credits to you in the project to make my teachers look at your videos. I was thankful, but now I want to give thanks to you in the personal way, without you I couldn't made my course. Thanks again, keep doing this videos, this is worth to see :D
Thank you so much for that encouragement, Toshito! That is wonderful. I sometimes wonder if it's worth all of the trouble to make the videos, but then it's messages like yours that tell me "Yes!". :-)
I'm very happy that my videos helped your project pass the test. :-D
Hey man, I've been doing VB for a couple semesters. I had a project that required me to make a game. I decided to try my hand at an rpg... but I didn't wanna use pictureboxes, cause i wanted smoother animations. A friend from class pointed me to this video, and I gotta say, you are a BRILLIANT teacher! I learned so much from watching these videos, and not only did I pass the assignment... but the teacher stopped me after class and asked me to demo my rpg to his class next semester. thanks again!
Man thank you! It's hard enough to find good videos on modern VB let alone game development because either they utilize the Timer control or they use a game engine like Raylib or Monogame. Not that I have anything against those game engines because I absolutely love them but I was looking for something that really peels back the layers and gets down to the basics especially in creating a frame counter system and using GDI+ which is exactly what I was looking for. This technique and information is timeless and is still relevant today so I appreciate you keeping these videos online and available for consumption. 😎
I'm glad these ancient videos are still finding some use. I'd wrestled with the idea of removing them or telling people, "Omigosh! Please don't use this to make a game!" 😆 Still, there are many good uses for GDI+ and since it's native to Windows, it still works today and without having to install a bunch of support packages or frameworks.
the thing is ive programmed in vb for about 4 years now and ive never really seen it as a visual intensive language good job
I'm glad I can still find this version thanks.
Hi Aardaerimus, just wanna say that your tutorials are a huge stimulance to making games. I had created a mod for Minecraft which was in Java, and now that they made a new update I nearly have to start from scratch. It was therefore I started looking for tutorials on making my own game. Yours open up a world of new ideas. Ive made your map run more smoothly (the map now scrolls per 10 px, instead of 50) and I added some Gui's. Thanks heaps for your tutorial. Unfortunately I suck at graphics...
Watched 5 minutes into this tutorial, seems really high quality. Will have to take a closer look tomorrow when I'm less tired. :)
This is a really great video tutorial. Very easy to understand and works perfectly. I'm working on a project and I chose vb to make a simple 2d game, and this video is a great help. I'd give it 10 thumbs up if I can
Yes, it's amazing what can be done in Visual Basic. For a long time the game development community has regarded VB as a bad language for game development, but I've always felt that it could be used effectively to produce classic style games. With the advent of XNA and the performance gains, the possibilities have grown immeasurably. :-D
@Aardaerimus lol, i put that there to mark my position in the video for when i return haha. Thanks for your vids man, you have proven to be a foremost teacher on these subjects.
Thanks, MrDuckBringer. :-) I hope you find what you're looking for. I highly recommend looking into some of the later tutorials, as well. They get better as they go, and XNA is so much more powerful than the GDI used in these old videos.
Just wanted to say that you sir = awesome...your tutorials (this series and the XNA) have really helped me out. I cannot thank you enough :-)
Thank you, Brian! I'm always happy when my tutorials are helpful. :-D
With Booleans, you don't need to add = True. You can just refernce the variable name and it returns true or false. So,
Do While isRunning
' Do stuff here
Loop
is fine. It does exactly the same thing.
Operators return true or false, too. So you can write more efficient code by using just a comparison with an operator. For example,
Dim playerDead as Boolean
Dim playerHP as Integer
playerDead = (playerHP < 1)
If playerDead then
MsgBox("Ha ha! You suck!")
End
End If
Here, the operator < returns true or false, and the = assigns it to the variable playerDead. You don't need the = True here in the If statement either. The variable itself returns true or false, satisfying the condition. Some people might like to write all this code out long hand for easier understanding, but it's always better to give the compiler fewer things to do.
if you use 'timeSetEvent()' and 'timeKillEvent()' you can create a timer class(i have 1, but only works with 1st instance :( )...
so you can use 2 timers(1 for the Game Loop and the other for the Second) with much more performance ;)
Followed up your tutorial, made 2 layers for a sidescroller and its working at 20fps. I did some optimization: e.g. not render tiles when they are air, hide/show the inventory, hide/show the background details. GDI+ does not use the GPU AT ALL and it doesn't have hardware acceleration. You even included double-buffering, which is ferfect for flicker-less draw! Thanks!
(i'm soon going to move to D2D btw)
You can just store the positions as points or separate variables and check it in the game loop, update sub, or at move time. If Pos.X > LeftEdge and Pos.X + 32 < RightEdge, etc. (If I'm understanding correctly)
thank you :-) It really is surprising what it's capable of now, especially with XNA. XNA blows the doors off of GDI in terms of graphical capabilities and performance. Every time I play with it I'm astounded.
@Susurlauks Thank you, Susurlauks! Happy to have you along. :-)
I've been using this engine for months and I thought I'd give XNA a try since I've been teached libGDX, and when I saw the sprite batch and the graphics device manager I said 'It is similar, let's make a game with it!'.
DIM used to be used to specify arrays. Later on, it came to be used to declare all kinds of variables, when the possibility to specify the type for variables was added.
Keep in mind, years ago, memory on some machines were limited to like 48KB... you had to be careful how you used it when you programmed, so DIM, short for DIMENSION, was used to set aside space for arrays
Thanks! You'll definitely be able to move things around with various methods once you learn the basics here. While this series is just an introduction and not "best practice", by the time you get through it you'll be able to move things around and you'll have a better idea of how things work so you can proceed on to better things. If at all possible, I recommend XNA over GDI, but this will still give you an idea of how things work.
@GTARockstarGamesVids
There are a few different ways to toggle between the form and code screens:
VIEW CODE:
1st - You can double-click your form to view your code.
2nd - From the menu bar (top), click VIEW --> CODE (F7)
3rd - Press F7
VIEW YOUR FORM:
1st - Double-click Form1.vb on the right, in the Solution Explorer panel.
2nd - From the menu bar (top), click VIEW --> DESIGNER (Shift+F7)
3rd - Shift+F7
Hope that helps. :-)
Thank you for coming! :-)
@jlt012 Usually, this means that the For X/Y loop is not propagating outward and downward properly and that all tiles are being drawn to the first square. Make certain that the destination rectangle is X * Tile size, Y * Tile size, the width is the tile size, and the height is the tile size.
For example, in your drawing loop:
(Using a tile size of 32)
For X = 0 to 5
For Y = 0 to 5
dRect = new Rectangle(X * 32, Y * 32, 32, 32)
G.DrawYourStuffHere(imagetodraw,dRect,sRect,etc...)
Next
Next
@KaraOP Hahah! Always a pleasure, Kara!!! I'm glad you're finding it helpful. :-D
Awesome to hear, Setonix Roo! Thanks for the encouraging feedback. :-D
I believe that a game loop, over which you have a greater level of control, is generally considered "best practice".
I can see how using the paint event might really help with GDI though. If it's only drawing when there's a form update, then you're not wasting resources with unnecessary draw cycles. :-)
@ThomyKz4 Always a pleasure, my friend! I'm glad that you found the videos to be helpful. I appreciate the positive feedback, too! :-D
thank you for the response i will be hoping to see an inventory video soon
this is an awesome video
there are so many in java and C++
its great to see one in vb.net
thanks. this was a great intro to programming a vb game.
i usethis video to fall asleep evry day....and it work and learned me how to programLoL
Yes indeed! I just went back to the project and instead of multiplying I had used an equals sign. Thanks for pointing that out. /sub
Ah, forget what I said: after meticulously experimenting with your code, I found that you did use the backbuffer correctly, but you shouldn't have put the "G = Me.CreateGraphics" line before StartGameLoop since that will in fact draw the first frame on the form instead of the BB bitmap. That confused me. By deleting that line and putting "G = Graphics.FromImage(BB)" on the first line of DrawGraphics() (before drawing anything) you can fix it. Glad I finally understand!
The XNA framework is designed to take advantage of the graphics processing potential of your graphics hardware. Windows Forms and XNA are not mutually exclusive. The two can be used together, though I believe that it will be somewhat less efficient than pure XNA. Still there are times where combining the two can be very advantageous (A map editor app, for example).
@LandMuffin Usually this means that your drawing loop is not drawing out the proper distance. In the dRect you should be drawing something like X * TileSize and Y * TileSize for the width and height of the tile.
The tile loop is is X = 0 to 19 and Y = 0 to 14 in this video (19:44). Follow this closely and you'll see that the rectangle is drawn at (X * 32) (Y * 32) so every time the loop steps through, the next number will move over 32 pixels and begin drawing the next square. :-D
Random mappers can be very tricky and complex. You can employ perlin noise and various other procedural generators, or you can make your own. I tried making my own map generator, though it worked, it was crude and hard to explain, so I didn't make a tutorial. The source is, however, available for download.
The hard part in randomizing is making meaningful structures and connections between those structures. It can be done but takes a lot of planning and design.
Inventory, I HOPE to do soon.
Hi there! That's the main problem with GDI, unfortunately. GDI does not actually utilize your graphics hardware, so the performance is significantly different for each CPU.
If you have a chance, I'd strongly recommend using XNA over GDI. If you must use GDI, the best way to overcome the slow FPS is going to be by keeping your drawing screen very small. The fewer pixels it has to draw across the screen the faster it will go. To make it appear larger you adjust down the monitor resolution.
Great Thanks :DDDDD. You courses are exactly what I have needed and looked for! And this first one really works :). However, there is one little mistake from which I wish to inform other users. When You run the program, after that an error occurs for me at the definition BBG = Me.CreateGraphics(). If You remove the "Me.", it works correctly. Other alternative is to move the definition to INSIDE Form1 subprogram, after Your comment: "'Initialize graphics objects".
I can't believe how much I learnt in half an hour....
Really helpful with creating a View your FPS, for performance issues. plus if you don't a bug during testing it isn't a "Kewl" tutorial because most of us have one during a 1st Trial anyways.. Thanks for Sharing the wisdom.. :)
I'm glad it was helpful! Thanks for the positive comment. :-D
hey, aadaerimus, i been watching you for 2 years now! :D
No sabia que se podia hacer juego en Visual Basic !!, ya que me gusta programar ahi. Quiero decirte tambien que entiendo tu idioma , I also speak inglish !!. Thank you broth !!
You need to declare a variable for "MaxTicks". Learning the basics before trying to write the bigger projects :)
By far one of the best game tutorials out there. I want to take a second to thank you for the series of game design on visual basic. Also in the video you mentioned handling character movement which i could not find on your channel, maybe i am just blind, is there any chance you can give me a link to it? Ive done quite a few programs 1000 lines or less but id like to try this out to see if its for me before i get into a different program for design, so any tips you have would be great. Thanks:)
This is a great tutorial, you have really done well.
Probably one of the best programming tutorials ever! The only difference is my FPS and tick counter stayed at "0". Are you like a programming college professor? Lol
Thank you, very much! :-D For serious games, I highly recommend a graphical framework better suited for game programming (XNA, SFML, SDL, etc.) With XNA, I've seen FPS between 3000-8000. GDI is very unpredictable in terms of performance, from one machine to the next, due to its inability to utilize graphics hardware properly.
Aardaerimus D'Aritonyss, LIAR! XNA is by default capped at 60 FPS...
It sounds as thought you may be stuck in an infinite loop. Make sure you don't forget the "Application.DoEvents" inside of your endless loops, and add a way to stop the main loop. Something like an "IsRunning" variable that you can evaluate. :-)
Do while IsRunning = True ... etc.
It worked, thanks a lot; sometimes I forget how sensitive the IDE is.
Incredible Tutorial for beginners
Quick reply! And thanks Aard, that makes sense. I will probably just stick with using (and learning) XNA exclusively :)
Nice, had to change a bit of code to get it looking right on my screen, but it wasn't too much, thanks for the tutorial :).
If you're interested, I did a "reboot" of my old DragonDrop game and it's much cleaner and more efficient than what I had in these old tutorials. While I still don't recommend using GDI for games with a lot of movement, it was a fun little project and is much cleaner and simpler than this tutorial code.
I welcome you to download the project here: www.aardaerimus.com/sourceshare/gdiSource.asp
@T3RRABYT3 Ahhhh lol
I had a feeling that it might be something like that. I know I goofed up in a few videos, and I was wondering if this was a pointer to one of those 'finer moments', but I checked at it seemed normal enough. heheh
I appreciate ya stopping by, and thank you much for the encouraging word! :-D
hey thanks for the tutorials, they are awesome, i just wanted to say, so far at least the examples don't load in visual basic 2010 express, but they do work if you just copy and paste the code :) it seems I may have to obtain the full package to use this xna however
I had the same problem. Make sure you've added the call to the TickCounter sub in the StartGameLoop.
I have to say you are a great teacher, so clear and precise.Have you written a book that I can buy with source code for games.
Hey man thanks very much for this tut,helped a lot to me.I have to do my graduate in programming section and i was given Direct3D and VB.net to do,with a little example like small game and thing,and i thing this will help me through...thanks again.
DIM - Declares a variable. EXAMPLE: Dim UserName As String = tbUserName.Text..... When declaring variables DIM is to be used inside a sub for use during that particular procedure PUBLIC can be used to hold a variable in memory for the duration of the applications runtime.
Thanks a lot bro, It really helped me out! Sucks it doesn't render at a great rate.. but still works for now.
How to make game logic in one thread, and rendering in another? By the way, good tutorial for games without THAT many elements. I'm rendering the world, and inventory ONLY ONCE, to reuse in the loop, and I get 50-60 fps. Nice. Once the world is rendered, there's no need to re-render it again.
It's old but very helpful,thanks a lot
You made this on my birthday :D
Thanks for these tutorials, subbed bro ;)
im watching this and copying it hope i can learn to make my own games!!
@Aardaerimus thanks for the nice answer
my goal for this year/ next year is understanding a few things you did in this video and to understand the basics and maybe change something so i could change it from my own mind and in a way i understand.
just the idea to creat a game which is working and to wich i can add some personal ideas and giving computer orders to make this work is huge for me even if its pong or a simple programm
I could imagine for what you what did but i wouldnt be able to do
Some I compose on my keyboard. Some I make with a music mapping program.
LMMS (Windows Version) - Linux MultiMedia Studio
Audacity - Audio Recorder
Also used ModPLug Tracker for a few.
@assassin132132
1.) Dim allocates memory space to a variable. Essentially, it's for creating a variable. Dim X as Integer = 2 creates a variable of an "Integer" type, and gives it a starting value of 2.
2.) Green words are comments. The compiler ignores them completely. They're used for making notes to yourself or others about what a particular section of code is used for - or anything else you want to comment about. To create a comment in you code simply start your line with a single quote '
@TheOrneryNerd I think what's happening is that the form is dumping drawing resources in the middle of its draw cycle, so it tries to draw with resources that no longer exist. The easiest way to overcome this is to put your drawing routine in a Try/Catch statement. That way it'll drop out in a friendly manner when the form is closed.
Yes, it can be done, however, even though VB.NET and VB6 are similar languages, there are many big differences - such as having to reference the GDI directly and using Bit Block Transfers (Blitting) for transparencies and whatnot.
For those who still follow this tutorial replace the line that assigns BB with this:
'BB = New Bitmap(resWidth, resHeight, Imaging.PixelFormat.Format32bppA)
Great tutorial! thank you so much.
No worries. :-) It means "Private Message". I sent it to you yesterday, so it should be in your inbox.
@PcPlayer992 Hahah!! It's an ancient Dell keyboard that I salvaged because I really love the old clicky keyboards. When I'm at work I'll have to see what the model is. I have a few of them at work that I've saved for myself over the years. :-)
Hi bro! This is a great and simple tutorial. Congrats. You have another follower :).
Cheers
Hey Aardaerimus. I find your videos helpful in getting to know the new way of .NET programming; it's been a while since I last tried game programming in VB. So thanks for making these. However, there is a fundamental error with your backbuffer logic; you're essentially just drawing an invisible (unfilled) bitmap (BB) over the already drawn stuff on the form (from your G object). You didn't ever fill the backbuffer - look at your code, you'll see!
Hi there! What version are you on?
I learned VB by just messing around and trying to solve simple problems at first. As I began to figure out how different objects worked together, I was then able to solve more difficult problems.
The most important thing to do when learning any programming language is to have a goal. You need a direction to go as you test your capabilities. You start with the easy stuff, then as you hit road blocks you check Google for the problem to find how to overcome it.
Great tutorials Thank you for taking the time to make them :P
This is typically because Either X or Y is not multiplying by the tile size.
@pheangsri It was provided by the company I work for, but I'm thinking we paid somewhere around $500 for it w/ the MSDN additions.
The nice thing about it is that you can build deployment projects that take a lot of the work out of version control and creating an exe or msi setup package. Also, I think it has more database connectivity features.
I don't wanna download any toolkit because any other toolkit is extremely hard to use and, e.g OpenTK only knows about triangles. However I'd rather use OpenTK than GDI+. If there's a way to downgrade from GDI+ to GDI it would be cool!
As i have seen on interner, here are comparisons: *300 elements
D2D-55 FPS, GDI+-20fps,GDI-50fps,WPF-33fps
*1000elements
D2D-33fps,GDI+-5fps,GDI-40FPS,WPF-2fps
Great video! Can i ask how you got so good and fluent at vb?
I'm just starting to try and create projects and I figured I would follow your tutorials until i can recreate something simple on my own. :D
Thanks, Harry! :-) Let me know if you have any VB questions that I can help with. You can also check out my VB Toolbox channel. It's geared more toward general VB and less toward game programming. The content there is a bit more fresh.
@burningac64 Hey there. Glad you stopped by. :-) I hope you find it helpful, too.
Hello, if for example somebody is running a game with this loop but has a slower machine... than will it effect the gameplay (for example a slower moving player at a slower framerate)? Thank you :-)
Not likely. To my knowledge, Excel uses VBA (Visual Basic for Applications) which is more of a macro language that is not compiled and is much more limited.
It may be possible if VBA has access to Windows GDI, but I wouldn't count on it.
Thanks, man! That's awesome. Feel free to any of my code in your games, though you gotta keep in mind that these are just very elementary approaches that should be refined dramatically before being employed in the real game dev world. ;-) I'm constantly learning new things and revising my approach. Then I come back and look at my old videos and go, "What was I thinking?!" lol
Isometric tiling... Whew now there's a worrisome beast. haha Yeah, I'd love to learn that myself.
very cool boss. Thx for the upload
Hey I liked your tutorial and where it was going. I had problems with getting DrawGraphics to work. I have no idea what the problem might be. I made a video response with a little bit more detail.
My pleasure! :-)
thanks man its realy cool that u respond and help out :)
Awesome! Very glad to be of help. :-)
the coordinates for the rectangle should be the for loops variables for X & Y * 32
Umm for the ticks maybe you didnt set it to equal the Maxtick every time the second would finish? check all these.
So here's a question I've been wondering about. What is the key difference between just a regular VB Forms Application game and an XNA windows game? I understand XNA is for more game development, but don't really understand the difference between the two.
Great tutorials, but I have a question on backbuffer. Does "G = Graphics.FromImage(BB)" always put the blank bitmap into G? Does BB EVER have anything other than a blank image? So is put of our look to always put a blank image in G, just to clear it later? I thought a copy of the screen somehow goes into BB at some point, but I just don't see it. Can someone explain this? I am just not seeing it in the code.
Hello, I'm currently doing VB in my Computing GCSE. I was wondering if there was any beginner guides you've made to VB? I know simple things, text boxes, save & load information, pick random numbers. Would love to make a game in my spare time to help reinforce my knowledge and also to get higher marks. Any help would be appreciated, thanks! :)
Do you have a github repository?
I do not, sorry. These ancient projects were all on my old server, though I think I might still have a handful archived somewhere. Dragon Drop 3 was the best simple GDI game project, unless you're specifically interested in the tile mapping.
@@AardaerimusDAritonyss they aren't on Dropbox either.
I probably need to veer towards a more popular language anyway.
Thanks a lot! These are excellent tutorials!
For this video, I was wondering why BBG doesn't have to be cleared like G does even though both draw something. Wouldn't BBG keep drawing over every previous image?
Cool tutorials man!
Where did you learned all that stuff?
Digging around and chatting with people who are better than me. heheh Best way to learn! :-D These are pretty old, though. You might wish to check out some of the XNA stuff - though even that is getting old, sadly. :-( I really need to update.
Aardaerimus D'Aritonyss Sadly Microsoft gave up XNA but there is a way to download XNA for Visual Studio 2012 is called XNA 4.0 (refresh) if you google that you'll find it!
I may check out your XNA tutorials too but I wanted to ask you if you can make XNA Platformer tutorials too?
you wouldn't happen to have a video on random dungeon creation and/or an inventory video would you?
It sounds to me like you may be using C# instead of VB. In your solution explorer, does your form name end in .cs or .vb?