ID:91907
 
Keywords: beginner
Introduction...

Taking the step from simply being a gamer, and going into the world of programming and development is a large step. It requires the willingness to learn, experiment, and take advice and criticism. It may be confusing at first, but as you learn you will be able to look back at your previous attempts and laugh. One of the most important things for the new programmer is how to ask for help, and learn from it. You should only ask for help after you have checked for examples of what you want to do in the resources section.


I need the code...

When asking for help you want to explain what you are trying to do, and what parts you are having trouble with. Below are examples of the right and wrong way to ask for something. This is a common question I have come across, along with a snippet of code I would provide to each question.

(R = Right, W = Wrong)

W: I want a GM code.

// The GM code.
GM

R: I would like to know how to give certain people in my game special verbs and stats.

// A global list containing the keys of our game masters, separated by commas.
var/list/GMs=list("Ulterior Motives")

// A global list of out players, GMs should not be in this list.
var/list/players=list()

// Create a datum type to hold all of our special verbs.
GM

// Kick people out of your world.
verb/Boot()

// Let the person using the verb pick a player out of our list.
del(input("Which player would you like to boot?","Boot") in (players))

// The mob type of our human players.
mob/player

//Give them some variables.
var
health = 10
strength = 3

//When they connect to a mob, this is not the same as New().
Login()

//Place them on the first non-dense tile.
..()

//If they are an admin give them our special verbs and stats.
if(src.key in GMs)
src.verbs += typesof(/GM/verb)
src.health += 20
src.strength += 10

//Otherwise add them to the list players.
else
players.Add(src)

As you can see explaining what you want, instead of asking for the code gives you much better results. This goes beyond just getting some snippet of code however. Now that you have "the code" what are you going to do with it? Typically the new programmer will copy and paste the code into their project. This is wrong, and you won't learn anything, nor will you be able to change it to fit your needs. Most of the time when asking for help you will get examples of how to do something, so you can learn how to do it yourself.


What are those double slashes for...?

Every programming language provides a way for programmer to add comments to their code to explain how it works. Why would they do such a crazy thing if they already know what it does? Sometimes programmers might forget how something works after going back to look at it later, but this isn't their only use. In the example the comments are used to help you learn what the code does. I can guarantee if you read these comments, and try to understand what the code does and write your own you will learn how to program much faster.

When I first started learning and asking for help, comments helped me more than anything. Gathor is the one who typically helped me with my problems on the forums, and reading his comments made learning how to program much easier. If I didn't understand something I would ask how it works, this is how to succeed at asking for help and learning from it.


Projects and goals...

Most new programmers read a tutorial like one of the great ZBTs, and they think they can jump in and create and start on a large RPG or some other massive project. This is an extremely terrible idea. You need to start small, and build on to that. Create a variety of small games to advance your skills and learn new techniques and ways of programming. Release this to the general BYOND community and announce it on the forums. Now people can comment on what you have done, and give you more ideas to add on. This way you can keep adding to this small project, and learn new things along the way.

Always set goals to achieve when starting a project(see also Functional Specifications for designing your project). For instance if you read ZBT #1 about creating RPGs, she has goals at the end for you to add onto the project. Try to complete these goals, then add your own. The more things to do the more you will learn, after doing this your programming problem solving skills will increase. Goals for <a href="http://www.byond.com/members/DreamMakers?command=view_post&post=36143" >ZBT #1 could include, making an NPC walk around, making an enemy drop a random item only 25% of the time when they are killed, creating random server messages that go to the players, or anything. Just stick with that one goal until it is completed.


Summary...

How fast or slow you learn to program, and how well you learn to program all depends on you. If you are willing to learn and don't get discouraged you will learn quickly. If you use the resources provided to you and take help as a learning experience you will learn how to do this the right way.

Just remember one of the most basic rules of programming, if you are repeatedly doing the same thing over and over with if statements and what not, then you are doing something wrong. This is where your programing problem solving should kick in. The more you know the easier this will be to do. At first though you might need to post it in the developer how-to and ask how to take out the repetitiveness. After a few weeks to a month you should be able to look at it and learn on your own how to do this.

If this helps even one newcomer break away from the typical fate of the new programmer, then my goal was successful. I will be around to help any new programmer as long as they are trying to learn and following this guide. Programming can be very fun and rewarding once you get the hang of it. Breathing air into and creating a project yourself is a good feeling.

I'll leave you with a quote by a very inspirational man that explains what I'm trying to say.

"When the race gets hard to run. It means you just can't take the pace." -- Bob Marley
Good start, I look forward to seeing some more.

I've been plugging away at BYOND for awhile, and I think you're right on the money that it's more about the journey than the destination.

If you start up Dream Maker for the first time today thinking that this is the day you're going to build Super Epic Mega Dream Game then you're going to be disappointed.

However, if you start up Dream Maker and think to yourself that this is the day you're going to learn something - anything - then that's a goal you can easily meet and feel good about.

Often, it seems Super Epic Mega Dream Game doesn't get built because you've worked hard on it. Rather, it emerges on its own when you were ready to create it. Like the master sculptor who says the statue was always there in the marble, he just had to learn how to remove the pieces.
A thumbs up for you.
I wrote this and submitted it I think in January. I figured it got trashed, nice to see it made the cut. =)
My apologies... it just got lost in the queue. Please keep submitting content!
Thank so much this tut ready did help me out!