Sign in to follow this  
Zyndrof

VB.net: How to continue on the journey from beginner to pro?

Recommended Posts

Hi there! Now that I've finished reading my first book on Visual Basic.NET I'm looking for source code to take a look at and learn from. Projects of the size of Pong, Tic-Tac-Toe or maybe even Tetris or Snake. Besides that, even though the question has been asked before; any other projects of the same size that I could program to teach me use the techniques I've learnt? And more espacially; how to use object oriented programming in my projects? Finally, I would like book suggestions on how to continue in my journey to become a programmer. Right now, I think I would like to stick with VB.net. If I was to pick up another language like Java or C++ I would probably just stop for good ^^ I'm getting somewhere in VB and I would like to keep progressing and not start all over again. Thank you in advance!

Share this post


Link to post
Share on other sites
Hello,
If by vb.net you reffer to the 2003 edition then I don't think you chose the easiest thing. I would say to start with VB6, but it is a bit too old, and if you are looking to do more complex stuff, vb6 is not the best choice, however it is very easy to learn and understand.

A better option would be the new vb from the visual studio 2005. It is available to download for free from the microsoft website, and there are a bunch of video tutorials as well to get you started.

When you want to progress you should start with C. As programing goes, C is the best thing to know, as ALOT of programing languages out there are variations of the C syntax. A few examples are PHP, Java, C#, C++. I personaly like C# and I use the visual studio 2005 one. It works very well with directx as opposed to vb6 and it is much more simple to use than the .net previous version.

If you decide to go with visual studio 2005 then check out the video tutorials from the microsoft website, same place from where you can download vs2005.

As a first program to do, I would suggest to do a Paint program. This pretty much covers all there is about objects and such.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zyndrof
Hi there!
Now that I've finished reading my first book on Visual Basic.NET I'm looking for source code to take a look at and learn from. Projects of the size of Pong, Tic-Tac-Toe or maybe even Tetris or Snake.

Why don't you attempt to create those games? [smile] You'll learn alot more than from just looking at someone elses source. If you don't think you have the building blocks yet to create these games, make something smaller or it could be a sign you didn't learn all too much from that book: Did it have exercises that you followed and also wrote yourself? Did you experiment with them?

Share this post


Link to post
Share on other sites
Quote:
Original post by EthanStorm
If by vb.net you reffer to the 2003 edition then I don't think you chose the easiest thing. I would say to start with VB6, but it is a bit too old, and if you are looking to do more complex stuff, vb6 is not the best choice, however it is very easy to learn and understand.
Although Visual Basic 6 is easier to learn, it cuts you off from much of what you should know today. Much of the .NET Framework and other things that you learn when using a CLI compliant language, like VB.NET, arn't an easy thing to get when using VB6. This doesn't mean that VB6 is a bad choice, it just means that by learning VB.NET, you can apply the knowledge you know to other CLI languages like C# or even Boo.

Quote:
Original post by EthanStorm
When you want to progress you should start with C. As programing goes, C is the best thing to know, as ALOT of programing languages out there are variations of the C syntax.
The language you choice doesn't really matter, what matters is the options available and what you should learn. I personally would recommend staying away from C if you want to learn C++. Going backwards from C++ to C is a better idea as it will keep you from picking up bad C habbits earlier on. One of the main advantages of using C++ is the ability to use concepts like object orientation and the amazing STL. Of course, I would still recommend staying as far away from C++ as one can when first starting out.

As I mentioned before, there are many other languages out there that teach you the concepts of how to program earlier on then if you were to learn through C or C++. Python, VB.NET, C#, etc are much better choices for beginners.

Quote:
Original post by EthanStorm
As a first program to do, I would suggest to do a Paint program. This pretty much covers all there is about objects and such.
A Paint program seems like a pretty complex project to me. You'd have to deal with:
  • Scope - How big can a paint program get? When will you stop programming? Will you stop when you have an MSPaint clone? GIMP?
  • GUI - One of the important things of a paint program is its GUI. GUI programming is an extremely complex issue to tackle and shouldn't be done if you don't know what you're doing.
  • Graphics - Drawing on the screen programatically is pretty complicated, let alone making the user draw on it for you. What other graphical tools will you have in your paint program?
Personally, I think taking on a paint program as a first project is a bad idea because of unbound scope and the complexity. Of course, you can attempt it if you want, but it's very easy to get overwhelmed when you're first starting out.

A good first project has a fixed scope and is extremely easy to implement. One such example is a hello world demo as you'll just get the first words on the screen. It really doesn't matter what language you use as instead of asking "How do I do this?", you'll be asking "What is this syntax in this language?".

As a second project, you can get some game mechanics going, while still keeping things simple. Tic Tac Toe introduces user input and game mechanics. It will also keep you motivated to move onto your next project: Pong. Pong gives you the ability to display realtime graphics on the screen. Once you have the ability to use graphics on the screen, you can then introduce some realitively complex game mechanics like Tetris. And everyone has to implement a Tetris clone [wink].

Share this post


Link to post
Share on other sites
It seems I made myself look like a Total beginner, which I'm not since I've read a pretty massive beginners book (about 800 pages).
I don't know about a paint program though, since the book created one in one of the chapters to introduce som graphics. Therefore I think I would use the book as a reference whenever something isn't working or whenever I don't know how to continue. That would lead to me not learning much.

I use VB2005 and intend to continue using it. I actually refuse to change language now ;) It took a long time to find a language I'm comfortable with and I won't trade it for at least a couple of months ^^

I would like to try building a Tic-Tac-Toe myself but I have no idea how to create the grid on which you play. After that I don't think it would be to much of a problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zyndrof
I would like to try building a Tic-Tac-Toe myself but I have no idea how to create the grid on which you play. After that I don't think it would be to much of a problem.

Alright then - problem solving is probably the most important skill for a programmer, so why don't we have a think about this problem and see if you can come up with a solution?

You need to figure out how your program is going to store the play-area internally, you need to figure out how you're going to display it to the player, and you need to figure out how the player is going to interact with it.

A quick ASCII diagram of a tic-tac-toe board:

X| |
-+-+-
|O|
-+-+-
| |


So, how could you respresent that programatically? The play area is a 2 dimensional grid measuring 3x3, and each square can have one of three states (unoccupied, X, or O).

How could you display it graphically? Are you going to be drawing your own client area, or using WinForms - it could be as simple as selecting an appropriate control, or you might want to draw your own custom interface.

How could you handle input? If you've gone the WinForms route then the control you've selected to display each cell may provide you with the options you need to control this. If you're looking for a simple keyboard input method, you could consider the keys on the numpad. If you're drawing your own interface and want to use the mouse you might need to figure out how you could find out where the user has clicked.


So with a couple of hints there do you have any thoughts on how you could solve any of those problems?

Share this post


Link to post
Share on other sites
Quote:
Original post by Demosthenes
I've made a tic tac toe program a while ago in vb .net - help yourself


You're not actually helping.

I know you mean well, but you're not. Problem solving is the number one skill for programming. You'll have to develop the skill at some point to be even moderately competant. It is a crime to throw slabs of code at newbies facing problems and say "oh, look how I did it". You may have done it well, you may have done it elegantly, hell, you may have turned your source-code into a tutorial, but then, that's the point - you have done it. If the newbie reads your code and goes "oh, so that's how I should have done it", that's one less opportunity for them to work it out by themselves. One less opportunity to make mistakes and correct them, thus learning the pitfalls (they can't see the code you've deleted and rewritten, can they) and avoiding them, one less opportunity to excerise their brain in the vital stage of "now how the hell am I going to approach this problem?". That's a really important stage.

Think about it: A very common newbish question is "How do I make a game?", or "How do I make an FPS game?". Obviously, there's no receipe book for games. A better question could be "How do I make this game?", and list a billion requirements (an SRS document would be great!). Likewise, newbies must ask themselves questions such as "How do I solve this segmentation fault?", rather than look at your code and think "oh, if I code like him, I won't have any".

Wow man, that turned out to be really long!

Zyndrof: I would go for Pong. It has everything you need: Graphics, User Input, AI, Physics, the works. And it's pretty easy too.

Hope that helps.

Share this post


Link to post
Share on other sites
Thank you all... I will try figuruíng out how to make Tic-Tac-Toe and Pong.
About Tic-Tac-Toe: The problem for me is not how to use the grid, but to make the grid. There are probably a few different solutions to this. For example; there may be a control in VS 2005 that I can use to make it easy for me OR I have to create the grid myself somehow using lines and creating invisible squares inside them, then checking if the user interacted with the square, in that case, whose turn was it?

Is there a control for this?

Share this post


Link to post
Share on other sites
An easy solution would be make a 2d-array containing some tile info and drawing the tiles as bitmap images. You apply all the logic to the 2d-array and reflect that logic in the bitmap images.

Good Luck,
Jeroen

Share this post


Link to post
Share on other sites
Quote:
Original post by Zyndrof
About Tic-Tac-Toe: The problem for me is not how to use the grid, but to make the grid. There are probably a few different solutions to this. For example; there may be a control in VS 2005 that I can use to make it easy for me OR I have to create the grid myself somehow using lines and creating invisible squares inside them, then checking if the user interacted with the square, in that case, whose turn was it?

Is there a control for this?

You could use 9 button controls, and change the text when they're clicked. You could do the same thing with picturebox controls, but loading a different image.

If you're drawing it yourself you'd be capturing the click events to the form itself (or to some sort of container on the form).

You could possibly represent the play area in memory as a 2d array.


Tic-tac-toe is a two player game - so you could simply store either a 1 or a 2 in an integer to keep track of who's turn it is; every time someone makes a move it changes to the other person's turn.


There are plenty of other solutions as well, but those are a couple of thoughts that might give you a starting point.

Share this post


Link to post
Share on other sites
Allright, here is my very simple and not-so-fun-looking Tic-Tac-Toe!



Now, could someone tell me the theory of Pong or even better show me an example of a simple pong game, doesn't matter what language the game is written in.

Share this post


Link to post
Share on other sites
Pong is just poor-man's table tennis. On the left side of the screen, you have a paddle that slides up and down; ditto for the right side. A small ball bounces between the two paddles. The ball will bounce off the top/bottom edges of the screen, but fly through the sides; if the ball gets past one of the paddles, the opposite player scores a point. You play to 20 points, or whatever number seems appropriate.


As has been said, problem-solving pretty much is the skill behind programming. Writing weird-looking words and symbols has nothing to do with actual programming. (And, therefore, learning a language like C would be a total waste of time and quite counterproductive for you at this point - so good job on sticking with VB.Net. It's a good choice.)

One of the best places to start problem solving is specifying new projects. It's much harder (generally speaking) to figure out what needs to be done to accomplish a given goal than it is to remove problems from an existing piece of code. That's why looking at code examples is dangerous - the temptation is to just copy it off and not ever understand the problem-solving process that created the code in the first place.

Since that process is what you want to learn, I'd highly recommend breaking away from the desire to look at sample code for everything. Get to a point where you can solve the problems on your own; then start reading code from better programmers, so you can find better ways to solve the problems. There is no substitute for experience here. You will do much better if you learn "the good way" and know what the "bad way" looks like as well as why it is bad. Just learning the "good way" and assuming that code is good because someone linked it to you on GDNet is a recipe for disaster.


So, now that I'm done preaching... [wink] Step 1 for creating Pong is to determine what exactly you need to do in order to create it. I've given a rough description of the game; your first objective is to list out each individual element of the game and what code will be needed to make that element work. Be as specific as possible. Writing actual code is not allowed yet.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zyndrof
I use VB2005 and intend to continue using it. I actually refuse to change language now ;) It took a long time to find a language I'm comfortable with and I won't trade it for at least a couple of months ^^


Good philosophy. I wasted a lot of time when I was new to programming jumping around from language to language and never accomplishing much. Pick something, get comfortable with it, and use it to later on broaden your horizons. With a language like VB.NET you'll be able to easily -- like Rob said -- move on to languages like C# and such without much difficulty.

Good luck!

Share this post


Link to post
Share on other sites
I'm a bit on my way of creating pong now... I put together some nasty looking code that makes a ball bounce back and fourth on the edges of the screen. Waiting with the paddle, now I understand the mathematics at least... Just the problem with erasing the ball before drawing a new one... The screen looks like a close-up on one of the 101 dalmatians ^^ Thereafter it shouldn't be too hard to sraw a paddle.

Who told me programming was difficult? :P

Share this post


Link to post
Share on other sites
I have finished both Tic-Tac-Toe and Pong. Is Tetris the way to go from now or is there an easier project I could attend first?
If Tetris is next I would need to know how to create the graphics for such a game since it's much more advanced than anything I've ever tried.
Do I need to use a GDI (that right?) such as managed DirectX or can I make it with just the tools inside the .NET Framework? In which case is there a tutorial that can teach me how to master the knowledge I need to have to be able to create my Tetris-game.

Finally: What knowledge is needed except for the graphical when making a Tetris game?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this