If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Read before posting: The basics of Programming/Game Development

Introduction

Ever wanted to make your own games or programs? With this bit of information, you can be set well on your way to doing just that.. Of course it'll take a ton of experience in programming boring stuff before you can get to the good stuff! So in this, I'll do my best to teach you those boring things in various programming languages so that one day you may be able to make games of your own!

Interpreter: Executes high-level program immediately after translating each individual instruction.

Variable: A memory location/unit named or labeled so it can be used in a program.
Examples: X = 1 (X being the variable) A+B=C

Variables must have THREE things:

Name (Identifier): You come up with it.

Type: What kind of info contained.

Value: Assign a value within the program.

Type: Indication of what kind of data.;

There are EIGHT primitive (Basic) data types:

Byte [Holds Integers] [Responds to a single Byte (-128 - 127)]

Short [Holds Integers] [Responds to two Bytes (-32,768 - 32,767)]

Int [Holds Integers] [Responds to three Bytes]

Long [Holds Integers] [Responds to eight Bytes]

Float [Holds Decimals/Fractions] [Responds to four Bytes]

Double [Holds Decimals/Fractions] [Responds to eight Bytes]

Char [Holds a Single Unicode Character] [Responds to two Bytes (Must be Identified)]

Boolean [Holds Two Values: True & False]

Loops: Instruction sequences repeated.
Examples: Timer; Clock

Module: Part of a bigger system, it's plugged into, that interacts with the rest simply/properly.

Object: A kind of module holding data and subroutines.

State: Contained data.

Class: Objects containing the same data type and responding to the same message similarly.
Example: When you do a math problem like "5+7*3/9-6+5" you don't just do it all at the same time, you break it down. That's basically what classes do.

Subclass: A class within a class.

Command-line Interface: One person to one computer "terminal", typing commands and getting written responses.

Program Counter (PC): A register keeps track of the next instruction the CPU uses.

Transistors: Millions of tiny switches that go on or off in the way they are wired together with the executing program, makes up the whole of the computer.

Literal: A constant value in program representation.

Syntax: The vocabulary and rules that govern a computer program.

Semantics: The program meaning and logic that, when done correctly, does what you want it to.
Examples: Instructions; Commands

Source Code: The sum of the program's syntax, Semantics, and Logic.

What's the best place to start?

There are many places you can begin, and it's entirely up to you. Now of course, you don't have an understanding of any language yet so I'll provide you a brief over-view of the mains ones (They are NOT written by me):

Java: "Java is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users.[10][11] Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them." ~http://en.wikipedia.org/wiki/Java_(p...ming_language)

C: In computing, C (/ˈsiː/, as in the letter C) is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs.[4] Like most imperative languages in the ALGOL tradition, C has facilities for structured programming and allows lexical variable scope and recursion, while a static type system prevents many unintended operations. Its design provides constructs that map efficiently to typical machine instructions, and therefore it has found lasting use in applications that had formerly been coded in assembly language, most notably system software like the Unix computer operating system. ~http://en.wikipedia.org/wiki/C_(programming_language)

C++: C++ (pronounced "see plus plus") is a programming language that is general purpose, statically typed, free-form, multi-paradigm and compiled. It is regarded as an intermediate-level language, as it comprises both high-level and low-level language features.[3] Developed by Bjarne Stroustrup starting in 1979 at Bell Labs, C++ was originally named C with Classes, adding object oriented features, such as classes, and other enhancements to the C programming language. The language was renamed C++ in 1983,[4] as a pun involving the increment operator. ~http://en.wikipedia.org/wiki/C%2B%2B

HTML: HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like <html>), within the web page content. HTML tags most commonly come in pairs like <h1> and </h1>, although some tags represent empty elements and so are unpaired, for example <img>. The first tag in a pair is the start tag, and the second tag is the end tag (they are also called opening tags and closing tags). In between these tags web designers can add text, further tags, comments and other types of text-based content. ~http://en.wikipedia.org/wiki/HTML

There are many more, but these are the main ones you should know about for now.

Where can I go to learn more?

If you are very serious about getting into Programming, then College is the best place to go. But, if for some reason, college isn't a choice, then YouTube is where you should go. Yeah, you could just look it up on Google then just copy & paist, but you won't learn ANYTHING that way. The point of learning how to code, is, well learning. That's why I feel YouTube's a good alternative from school... It's free, you have to read it to write it, and a person can explain more in physical words than in text.

If you want to know a good YouTuber that does these kind of tutorials, TheNewBoston is the best. He thoroughly explains whats going on more than once, shows you how what you learn can be used in everyday programs, and he's just a plain cool guy.

Java (Downloads)

How to start Java
Java may be pretty easy to use, but it's fairly difficult to set up.

1) Download a compiler. You can find multiple over the internet, but the best is, of course, the original. To grab this, you'll need to go to http://www.oracle.com/technetwork/ja...ads/index.html. Right in the middle-left of the page there should be a button that says "JDK" in it. That's the one you want. You'll be directed to the download page, now this part is important make sure you accept the Oracle Binary Code License Agreement before anything else.. After you accept it, select your correct operating system and its type (x64 or x86/x32).

2) Once you've finished the download for the compiler, you'll have to set up a path within your computer. This part involves going into your systems settings, be very careful while you're in there.

Go into you're files , then get into your main hard drive (Usually it's under "Computer") and go in "Program Files. When in there, there should be a file called "Java", click into that. If you downloaded the Compiler correctly, there should now be a file called "jdk" and it's version. If there isn't, go back to step one and redo it. Click into "jdk", then into "bin". Now right click the file on the very-top of the list and click "Properties". In it's properties, it says it's location. The location is what you want, so copy it. After you copied just it's location, you can cancel out of everything. Open up start, and right click or open "System" (Depending on operation system) then go into "Advanced System Settings".
At the vary bottom of the "Advanced" tab, there should be a button that says "Environment Variables...". Click on it. THIS IS WHERE YOU MUST BE SUPER CAREFUL! DON'T TOUCH ANYTHING EXCEPT WHAT I TELL YOU! Under User Variables, underneith the box of words should be three buttons: "New"; "Edit"; "Delete". ONLY CLICK "NEW".
Under Variable Name, put "Path", and for "Value", paist the location you copied earlier.
Now click "OK" then "Apply". The scary part's done.

3) Lastly, you'll need an IDE to code in, and the best for Java is Eclipse. To download eclipse, go to: http://www.eclipse.org/downloads/
From there you'll be given a list of useful programs made by the company, but for now just download the "Standard Edition" (Remember to use the same operating system and xBit used for the compiler).
This'll be compressed, so you'll needs a program like 7-Zip to unzip it.

4) Open up Eclipse! If everything was done correctly, it should open up just fine.

This is a basic 3-line program, it prints out "Hello World" to the command prompt.

Code:

class <Insert Class Name Here> {

This tells the computer to convert all files into .class for the duration of the program (You have to define which class you're working with; if the class name does not match and/or it is not defined in the program, it will not run).

Code:

public static void main (String[] args) {

public- allows the current function to be used within other classes (Easy why to remember it is as in Public property, anyone/everyone is allowed to enter)
static- basically says that it's not running anything special, only working with the class and no specific instance of the class
void- indicates that the main method does not return any value to the caller
main- tells the program where to start reading; without which your program won't work.
(String[] args)- every main function must accept String arguments, this says so.

Code:

System.out.println("Hello world");

System.out- tells the system you want to out-put a variable
.println- defines that you want to out-put a line of text
();- Where you enter an argument OR ("Hello World") define one. In this case, you'd put a pair quotation marks and your text in the middle

C++ (Downloads)

Now, if you read the section above, you'll learn how to start using Java. If you feel that Java isn't your "strong side", then I'll recommend you to C++.

What this does is it prints out "Hello world!" on the screen. The break down

Code:

#include <iostream>

Line 1, it "imports" pre-written code for practical/convenient use. It includes basic input/output functions.

Code:

using namespace std;

Every standard C++ program is written in whats called a "namespace"; in this case its "std". The ";" declares the end of a line.

Code:

int main ()
{
}

This declares the beginning definition of the main function. This is where all C++ programs begin the execution. The "()" is a function declaration that usually have a pair of perimeters, but just left empty in this case. The main function is held within the "{ }" that comes after.

Code:

{
cout << "Hello World!";

The "cout" is used to display integers/strings onto the screen (A good way to remember this is "Console Output"). The "<<" represent it being "sent" out; and finally you write the desired output within quotation marks (" "/ ' '). End the line with a ";".

Code:

return 0;
}

The "return" statement is used to declare the end of the main function (Or others, for that matter) and is usually followed by a return code (In this case it's "0") that tells the program that it ran flawlessly, without errors.

That's about it for this program. Congrats, you can now code in C++.

Malbolge

Ahh.... Malbolge. This isn't one that you'll most likely ever use (Probably no one in this lifetime). The peculiarity of Malbolge is to be literally IMPOSSIBLE to write any useful programs with it, making it very little known to most people. Although, a little weak point in the system has shown that it is possible to work with, still immensely hard unfortunately. So why am I teaching you something you'll never need? For knowledge sake, it's always good to know more.

Fun Fact!: Malbolge is so difficult, it took two years for the first program to be made.

This guide is great! I now have a new source to be learning more about a programming language im not so familiar with yet!
I honestly prefer starting out making simple programs in command prompt though...

This guide is great! I now have a new source to be learning more about a programming language im not so familiar with yet!
I honestly prefer starting out making simple programs in command prompt though...

Thanks!

That's exactly what everyone should start with. My first "game" I made was a simple command prompt that used java.util.Scanner and java.util.Random to take in user data and create a random integer for a variable I called "Comp". It was just basically a 1 beats 2, 2 beats 3, and 3 beats 1, it's not much but it was my first game hehe. I've recently moved on from Java to C++... I like C++ a lot more now that I learned Java lol.

"My eyes see everything I want them to I just don't want them to see you."

Fun fact, Growtopia (both the client and the server) was written in C++!

I dare you to write it in Malbolge!

I've given up on my old antagonist ways and now I've decided to take up a new life as one of those extremely supportive and totally nice forum folk! BRACE YOUR BODY FOR MY INTENSE APPRECIATION FOR WHO YOU ARE AND WHAT YOU STRIVE TO BE.

Indeed.. Have you seen the 99 bottles of beer in Malbolge? Jesus Christ, it looks like WAVES.

I've given up on my old antagonist ways and now I've decided to take up a new life as one of those extremely supportive and totally nice forum folk! BRACE YOUR BODY FOR MY INTENSE APPRECIATION FOR WHO YOU ARE AND WHAT YOU STRIVE TO BE.

I've thought about that and the one problem I find is, I don't really understand it myself.. I mean the coding is pretty straight forward, it's just that it'll take up a ton of time explaining how to download, format, and compile HTML in Notepad++. If I had some free time, I might consider it.. I can assure you I'll get around to it eventually.

"My eyes see everything I want them to I just don't want them to see you."

I've thought about that and the one problem I find is, I don't really understand it myself.. I mean the coding is pretty straight forward, it's just that it'll take up a ton of time explaining how to download, format, and compile HTML in Notepad++. If I had some free time, I might consider it.. I can assure you I'll get around to it eventually.

Well along the description i would reference w3schools.com (its how I learned Html) because they do have an editor that you input html and it will export it into a preview (though the actual tutorials on the website were not very explanatory so i had to learn html by messing around with everything at the time)
I guess it would be a temporary solution for html then when you want to you could add additional information on setting the workspace up with Notepad++ (in fact i don't fully understand setting up some parts of notepad++)