Wednesday, July 25, 2007

Been a Long Time

I Havnt Posted in a Long Time because i am currently developing a stand alone site to accomodate my articles/projects. Its Coming Along Well and I am learning ALOT. If you want to Check it out its http://pyromaniac4382.xenweb.net . I am trying to find a click and drag system, to make displaying the articles easier, probably javascript, but soon articles are going to be streamlined in every day, they are just lying around on my hard drive right now...

Wednesday, July 18, 2007

Chapter 1.2

Chapter 1.2 - Program Structure - to be continued later



Following suit with the Lanuage Specification

1.2 Program Structure

Hierarchieal structure of C#
1. Programs
2. Namespaces
3. Types
4. Members
5. Assemblies


1. Programs
Made up of one or more source files.

2. (revisiting)Namespaces - Namespaces simply hold information. Two namespaces can have the same information. A good example of this is one i have reworked thats is found in chapter three...


namespace helloworld1
{
class hithere
{

static void Main() {
Console.WriteLine("Hello, World");
}

}

}

namespace helloworld2
{
class hithere
{
static void Main() {
Console.WriteLine("Hello, World");
}

}

}

As you can see the two namespaces above contain the same class and the same helloworld method as above. Don't think too much into it. I will do that for you.

Game programming example. Why you would use two different namespaces, with the same information.
Lets take any game with Swords in it. Swords are very similar to each other. They would have a size, maybe a sharpness, or even a weight.
These properties all apply to a sword so you might have a namespace for say the "Game - Zelda", and one for "game - Final Fantasy", each
containing a sword class, each containing the properties os size, sharpness, and weight.


Now lets take a look again at that line, using System; ,
This line references the System Namespace, which contains a bunch of stuff that is used in console applications, like this HelloWorld application uses,
if your wondering whats in it, i have no clue, but i am sure google does.

For this application we need to use the System namspace because it contains the Console class, translation: its got what we need to make the console write a line of text, etc.

3. Types - There are two type of Types i will go through just about every type and give a small explaination/range of each, hopfully to spark proper use of types,( and not always just using int.)

I. Value Types - i. Simple Types, ii. Enum Types, and iii. Struct Types.
II. Reference Types - i. Class Types, ii. Interface Types, iii. Array Types, and iv. Delegate Types.

I. Value Types
i. Simple Types - predefined struct types
1. Signed Intergral
2. Unsigned Integral
3. Unicode Characters
4. IEEE Floating Points
5. High Precision Decimal
6. Boolean

1. Signed Intergral - Signed Integral numbers are either Positive or Negative values
a. sbyte -128 to +127
b. short -32,768 to +32,767
c. int -2,147,483,648 to +2,147,483,647
d. long -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807

2. Unsigned Integral - Unsigned Integeral numbers are only Positive Values
a. byte 0 to +255
b. ushort 0 to +65,535
c. uint 0 to +4,294,967,295
d. ulong 0 to +18,446,744,073,709,551,615

3. Unicode Characters- Simply any single character on the kyboard.

4. IEEE Floating Points - Non-Precise Decimal Numbers (are rounded by your machine)
a. Float - ±1.5e-45 to ±3.4e38 Precision : 7 places
b. Double - ±5.0e-324 to ±1.7e308 Precision : 15 - 16 places

5. High Precision Decimal - Precise Deciaml Numbers
a. Decimal - ±1.0 × 10-28 to ±7.9 × 1028 Precision: 28 - 29 places
6. Boolean - True or False
a. bool - Store the Value of True (1) or False (0)

ii. Enum Types - Define a set of related Constants

1. User-defined types of the form enum E {...}

No two Enumerated Types can have the same name. I am sure an example is nessesary here.

Example:
enum Swords
{
MasterSword,
Excalibur = 10,
GreatSword
}

iii. Struct Types - Light weight objects , and can contain constructors, constants, fields, methods, properties, indexers, operators, events, and nested types

You can think of struct as scaled down classes, and are used to group data whwhich is relative. Structs are defined by :

1. [attributes] [modifiers] struct identifier [:interfaces] body [;]

Structs can be instantiated with or without the new operator
The difference between classes and structs are in their type. Structs are a value type (stored on the stack) while classes are a reference(stored on the heap).
Example using a class

public void swordswing1()
{
Sword MasterSwordPower = new Sword();
Sword ExcaliburPower = MasterSwordPower;
}
Example using a struct

public void swordswing1()
{
Sword MasterSwordPower = new Sword();
Sword ExcaliburPower = MasterSwordPower;
}
Because structs are store on the stack, you are assigning object to object, losing efficientcy, while the class stores a reference to the object on the stack.
Stucts do not support inheritance.
Struct do support contructors, which are method with the same name as the struct

using System;

struct Sword
{
private string Name;
private string Type;

//Structs' Constructor
public Sword(string name, string type)
{
Name = name;
Address = address;
}

(Continued in next post)

II. Reference Types ( going to be finished in next post)
i. Classes (reused from first lesson)- I have always been told that a class is like a blue print, so i am going to go on that pun. (reused from first lesson)

A class is like a blue print, lets use swords again. Like mentioned above you have your class sword, that contains properties such as size, weight, and sharpness.
Never mind syntax for right now, or the attributes within the members.



class Sword
{
Size
{
small
medium
big
}
Weight
{
light
heavy
}

Sharpness

{
dull
sharp
}

}

When you think about it, the class sword, will at some point become an object when implemented, without the members, which are in this case, size, weight, and sharpness,
we would have the same type of sword being created, the attributes within the members define a unique object, or plain object.

why? lets assume sword is the base of all other swords

Lets use another example

You are trying to create the Master sword, The want the Master sword to inherit all of the attributes of the Sword class, but have new attributes, like an
attack power.

class Master Sword : Sword
{
Attack Power
{
10000000
}

}


Master Sword Inherits all of the attributs of sword , which are weight, sharpness, and size, and has another member called Attack power.

This is a rouge outline of inheritance, remember we are only focusing on understanding basic concepts, syntax is not a concern right now for examples.


Friday, July 13, 2007

A Little Delay

The wealth of knowledge, and the amount of time that is spends breaking it down, there is a bit of a delay on posting, my next post is going to go over the first portion of chapter one of the C# Language Specification 1.2. It may take another day because im not quite sur ehow to set up this blog to display my information correctly, so i will link you out to my other site usually.

I would appreciate if you clicked on my ads, a game programmer has to make money too.

Tuesday, July 10, 2007

Day 1- My First Over-Analyzation of a Hello World Application


This LINK may be easier to read, made into an html Doc



So first we will go through the confusing documentation, and i am here to dumb it down, for myself, and by dumb it down i mean really, its not you , its me.
Next we will go thorugh the gamedev supplement to the reading, which is fairly basic, but again i will dumb it down.
So forgetting everything about programming, i am completely programming illiterate, carrying on with the maddness...

The hello world application

1. using System;
2. class Hello
3. {
4. static void Main() {
5. Console.WriteLine("Hello, World");
6. }
7. }


The most useless application ever created, but good to learn from.

BTW , we are using the most confusing documentation ever, im not sure, but i believed this is geared tword advanced users, so either they were thinking
"hey if they know how to program, than they should pick this language up fast", or "hey lets confuse the crap out of begineers to make them think this
language is amazing". The latter choice worked for me i guess.

http://download.microsoft.com/download/5/e/5/5e58be0a-b02b-41ac-a4a3-7a22286214ff/csharp%20language%20specification%20v1.2.doc


So now lets break it down to how i see fitting, a more logical explaination.
1. using System;
This line references the System namespace.
The semi colon ends a programming statement, It is like the period of sentances, used to declare, the first line is declaring that the system namespace will be used in the application.
Namespaces - Namespaces simply hold information. Two namespaces can have the same information. A good example of this is one i have reworked thats is found in chapter three...


namespace helloworld1
{
class hithere
{

static void Main() {
Console.WriteLine("Hello, World");
}

}

}

namespace helloworld2
{
class hithere
{
static void Main() {
Console.WriteLine("Hello, World");
}

}

}

As you can see the two namespaces above contain the same class and the same helloworld method as above. Don't think too much into it. I will do that for you.

Game programming example. Why you would use two different namespaces, with the same information.
Lets take any game with Swords in it. Swords are very similar to each other. They would have a size, maybe a sharpness, or even a weight.
These properties all apply to a sword so you might have a namespace for say the "Game - Zelda", and one for "game - Final Fantasy", each
containing a sword class, each containing the properties os size, sharpness, and weight.


Now lets take a look again at that line, using System; ,
This line references the System Namespace, which contains a bunch of stuff that is used in console applications, like this HelloWorld application uses,
if your wondering whats in it, i have no clue, but i am sure google does.

For this application we need to use the System namspace because it contains the Console class, translation: its got what we need to make the console write a line of text, etc.




2. class Hello

I have always been told that a class is like a blue print, so i am going to go on that pun.

A class is like a blue print, lets use swords again. Like mentioned above you have your class sword, that contains properties such as size, weight, and sharpness.
Never mind syntax for right now, or the attributes within the members.



class Sword
{
Size
{
small
medium
big
}

Weight
{
light
heavy
}

Sharpness

{
dull
sharp
}

}

When you think about it, the class sword, will at some point become an object when implemented, without the members, which are in this case, size, weight, and sharpness,
we would have the same type of sword being created, the attributes within the members define a unique object, or plain object.

why? lets assume sword is the base of all other swords

Lets use another example

You are trying to create the Master sword, The want the Master sword to inherit all of the attributes of the Sword class, but have new attributes, like an
attack power.

class Master Sword : Sword
{
Attack Power
{
10000000
}

}


Master Sword Inherits all of the attributs of sword , which are weight, sharpness, and size, and has another member called Attack power.

This is a rouge outline of inheritance, remember we are only focusing on understanding basic concepts, syntax is not a concern right now for examples.


3. "{}"

These are refered to are brackets. Brackets encase sections of code. You could say brackets represent the word contain.
An example of this in action is:


namespace helloworld1
{
class hithere
{

static void Main() {
Console.WriteLine("Hello, World");
}

}

}

The namespace helloworld1 contains a class hithere. The class hithere contains a Main() method(explained in next section). The Main() method contains a statment which writes "Hello,World" in
a console window.



4. static void Main()

This is the entry point of the program. All C# programs have one of four entry methods. A static method named main is always the entry point of a C# program.

static void Main() {...}
static int Main() {...}
static void Main(string[] a) {...}
static int Main(string[] args) {...}

void - specifys that the method does not return a value
int - specifys that the method returns a value of type int (an integer , a number, we will go throught types later)



5. Console.WriteLine("Hello, World");

This of a bowl of soup. Every line of code up until now is like the bowl, a place holder, and "Console.WriteLine("Hello, World");" is the soup.
The Console is reference from the System Namspace being used, and the method of WriteLine, is being called from the Console class, which writes the line of
"Hello World" in a Console window. You could put any text between the quotes, and the Console would Display that, lets take a name for example

1. using System;
2. class Hello
3. {
4. static void Main() {
5. Console.WriteLine("Bob Brinker");
6. }
7. }

Output: Bob Brinker



So thats enough for now. Going over some of the basic concept has been fun, and hopefully ,
the rest of the language specification will invoke as many questions and thoughts, and gear me tword a better programming experience




Day 1

Yawn long weekend stuff to do, but i am back now.

So apparently i was  suspended from gamedev for having duplicate accounts, but it really doesn't matter because they weren't very friendly there and i just need to be able to read the C# workshop i am participating in and don't really have to post, if i had any questions i would just go over to MSDN and get a logical, and very quick response. Their forum is very messy anyway. Anyway back on subject. So today I am going to go through chapter one and report back with the knowledge obtained, i sound so smrt :P.

obtain from what you say? C# language specification 1.2

After a bunch of consideration, and the fact that gamedev was having a work shop, i deceided to choose C# as my "language of choice", and really have no clue why other than the workshop, heh contridiction.

Friday, July 6, 2007

Starting Over

I am on a quest to become a PROgrammer!

This blog will be a supplement to see how i develop from a NUBgrammer to a PROgrammer.

I have been trying for years to become fluent in any programming language, it happens with everyone, they get so far into something, it becomes more complex, like c++ for example, and you move on to a simpler hobby, like sleeping as a hobby for example. :p

Not anymore though!

I have the whole summer for a starter, my goal, learn one, just one , if not more, programming languages, and do what every nerd dreams of doing, create my own computer game!

What exactly is the purpose of this blog and why would you read it?
 
       
       This blog is not only for me, it is for all of the struggling game programmers out there toiling up the trail of programming. I entitled this post starting over because right now i am going to forget all of the frustrating times ive tried to learn this trade, just like  many of you out 
there,
and start over, from the beginning . 

I encourage all of you to follow along with me on this journey!