Page 2 of 4

Posted: Sat Nov 05, 2016 2:26 pm
by Cheetory6
I think we're going Unity.

Posted: Sat Nov 05, 2016 3:42 pm
by chamber
Yeah, plan is Unity atm.

Posted: Sat Nov 05, 2016 3:44 pm
by xRECKONERx
/in to learn

Posted: Sun Nov 06, 2016 7:14 am
by chamber
Unity has some framing that is custom but lets you use 1 of 2 languages for scripting, one of which is c#.

Posted: Sun Nov 06, 2016 8:09 pm
by Clumsy
/in as student!

Posted: Mon Nov 07, 2016 2:11 am
by Majiffy
I'd be interested in learning the C's, not Java though.

Posted: Mon Nov 07, 2016 1:17 pm
by Flubbernugget
They're close enough to the same thing if you're beginning

Posted: Tue Nov 08, 2016 7:32 am
by theplague42
Ah unfortunately none of my experience is with Unity; I'm web. :(

Posted: Tue Nov 08, 2016 7:32 am
by GuyInFreezer
/in student

Posted: Thu Nov 10, 2016 2:03 pm
by Cheetory6
MS Project for Unity Development: Lesson 1
Spoiler: Description of Unity (shamelessly plagiarized from wikipedia)
Unity is a cross-platform game engine developed by Unity Technologies and used to develop video games for PC, consoles, mobile devices and websites.
First announced only for OS X, at Apple's Worldwide Developers Conference in 2005, it has since been extended to target 21 platforms.

With an emphasis on portability, the engine targets the following APIs: Direct3D on Windows and Xbox 360; OpenGL on Mac, Linux, and Windows; OpenGL ES on Android and iOS; and proprietary APIs on video game consoles.
Unity allows specification of texture compression and resolution settings for each platform that the game engine supports, and provides support for bump mapping, reflection mapping,
parallax mapping, screen space ambient occlusion (SSAO), dynamic shadows using shadow maps, render-to-texture and full-screen post-processing effects.
Unity's graphics engine's platform diversity can provide a shader with multiple variants and a declarative fallback specification, allowing Unity to detect the best variant for the current video hardware and,
if none are compatible, to fall back to an alternative shader that may sacrifice features for performance.

Unity is notable for its ability to target games to multiple platforms. Within a project, developers have control over delivery to mobile devices, web browsers, desktops, and consoles.
Supported platforms include Android, Apple TV, BlackBerry 10, iOS, Linux, Nintendo 3DS line, OS X, PlayStation 4, PlayStation Vita, Unity Web Player (including Facebook), Wii, Wii U, Windows Phone 8,
Windows, Xbox 360, and Xbox One. It includes an asset server and Nvidia's PhysX physics engine. Unity Web Player is a browser plugin that is supported in Windows and OS X only, which has been deprecated in favor of WebGL.
Unity is the default software development kit (SDK) for Nintendo's Wii U video game console platform, with a free copy included by Nintendo with each Wii U developer license.
Unity Technologies calls this bundling of a third-party SDK an "industry first".


tldr: Unity works on a lot of consoles/pcs and does a lot of neat visual stuff.


Spoiler: Task 1.00: Install Unity
https://unity3d.com/get-unity/download
For the purposes of this project [and really any purposes you'll likely ever need..], I would suggest using the Free version.
For this, we will be using Version 5.42. Try to make sure you have an up to date version if you already have Unity on your system!
Follow the installation process and if you have any trouble then refer to this Unity troubleshooting page:
https://docs.unity3d.com/500/Documentat ... Unity.html

If you're still having issues, drop a post in the thread or give us a shout on the discord and we'll try to help you figure it out.
Once Unity is installed, you'll need to create a Unity account. There's no fee or anything for joining, it just gives you better access to various features which can help you with your Unity programming experience
[and it's mandatory but I mean..]
If all worked as it should have, you should see something like this when you run the Unity shortcut:
Image


Spoiler: Task 1.01: Create your Working Folder
When you're developing/programming, it's usually best to try and keep all of your files as organized as possible.
Basically this lets you quickly/easily access stuff, saves you the headache of hunting around on your computer for where you saved something and helps you to keep your projects separated in a clean way.
You can mix things up a little if you want based on your personal preference of organizing things, but for me, I like to organize my projects as follows:
i) Create a folder on your desktop called "Development" [All of your programming files would then go in here]
ii) Create a folder within Development called "Unity" [All unity related files go in here and if you were to start using another language, you would create a new folder for it]
iii) Create a folder within Unity with the name of your project.

In this case, we'll be calling our project "HelloWorld". You can also help to organize your projects by giving them number prefixes to help you get to your most recent projects faster. IE: "01_HelloWorld"
[Sorting your folders by date made will also function in the same manner]


Spoiler: Task 1.02: Create first project
Image
When Unity is first booted up and you're logged in, you will be brought to the Project Wizard screen. Unfortunately there are no real wizards here, only project specification options.
Set the project directory to point to your working directory as we set it up in the last task.
For the purposes of this first project, you won't need to worry about importing any packages so just ignore that mumbo jumbo for now.
Underneath the login there's an option for choosing whether the project is 2D or 3D. For now we're going to stick with 2D, so please change the project to be 2D.


Spoiler: The Interface
https://docs.unity3d.com/Manual/Learnin ... rface.html
Image
I've highlighted and elaborated on portions of the interface that I feel are most important to understand [at least to start out with].
#Scene panel
:
A viewpoint that allows you to see the level that you're designing as you work. This viewpoint is meant to be flexible to allow you to get proper angles and orientations to edit things as you want them to look.
#Game panel
:
A viewpoint that allows you to see the level in the context of what the player will see as they play. You can only translate your viewpoint as a player playing the game and not as an editor. This is primarily for testing.
[Nothing will show up in this panel if your game isn't running]
#Hierarchy
:
Hierarchical text representation of every object in the scene. The hierarchy reveals the structure of how objects are attached to one another.
#Project panel
:
Shows all of your assets that you can currently use for your project
#Inspector panel
:
Allows you to view and edit all the properties of the currently selected object.
#Console
:
Place for the game to give text output for the programmer to see. Very useful for checking the status of various aspects of the game as it runs/testing for problems and bugs.
#Toolbar
:
Tools for manipulating the scene in various ways.

#Objects
:
"GameObjects are the fundamental objects in Unity that represent characters, props and scenery. They do not accomplish much in themselves but they act as containers for Components,
which implement the real functionality."
https://docs.unity3d.com/Manual/class-GameObject.html


Spoiler: Task 1.03: Hello World!
Now that you've got your first project going and you're a little familiar with the interface, we're going to jump right into your very first Unity program!
The first thing you're going to need is a game object. In Unity, most game behavior is represented by how game objects are programmed to behave/how they interact with each other.
In this case, we want an object that is programmed specifically to send us a message. So, to start, go to the menu at the top, select the GameObject menu and create an empty object.
If you look at the Hierarchy panel, you'll see a new object called "GameObject" alongside the Camera that was there before. In general, you'll want to name all objects [and really everything you ever use] in a way
that makes it a little more clear to you as to what they do.
IE: This gameobject that is going to send a message to you might be better named "Messenger" rather than just "GameObject". So, click it once and rename it.

Next, we want to actually create the code that will attach to this object to create and send the message to us when the code is running.
Move your attention to the Project Panel and find the Asset section. Right click and under the create section, choose C# Script. A new C#Script file will show up under the asset section with a generic name.
Image
We'll rename this file to SendMessage.
Open SendMessage and once you're done loading, you should see something similar to the following:
Image

This is essentially your first Unity Program. There's a decent amount to take in here if you’ve never programmed before or are a little inexperienced, so I'll ask you to mainly focus on two parts of the program:
i) // Use this for initialization
void Start () {

}

ii) // Update is called once per frame
void Update () {

}

The first block is a section of the code that will run when the object is created.
The second block is a section of code that will run constantly while the program is running.
For the purposes of HelloWorld, all we really want to do is send a single message to ourselves, so we'll focus primarily on the Start block.
In the empty line between "void Start() {" and "}" we're going to add Debug.Log("Hello world!");
This will write "Hello world!" to the Console [a part of the interface] when the program first starts if it is attached to an object.
Also, replace NewBehaviorScript with SendMessage in this line if it hasn't already been changed otherwise you may get a compilation error:
"public class SendMessage : MonoBehaviour"

Save and close your code editor and return to the Unity Editor. We have a script, but as of right now the script isn't doing anything because it isn't attached to a Unity Object. Think of a script as behavior and an object as something that does that behavior. IE: Walking could be a script and a person could be an object. A person can’t walk unless it is instructed to do so, right?

To instruct the Messenger object to send us a message, double click on it and bring your attention to the inspector panel. You should see a button that says "Add Component", click that and choose Scripts and then assign the SendMessage script that we created to it. If it worked, you should see the script as part of the object in the inspector panel:
Image

And we're nearly there! All of our program has been set up to run properly, now all you need to do is actually run the program. If you look at the top at the toolbar, you'll see a play button. If you hit play, your program will start.
If you click on the console, you'll see the following when your program is running:
Image

If you've reached this point, you've completed lesson one without incident! Congrats!


If you’ve completed the lesson, feel free to copy and paste your code in a post here or to screenshot the results of your code running. If you feel like experimenting and do anything neat, please share that too. And obviously if you have any questions just shout em out and we’ll do our best to help.
If there’s anything in the format/presentation/or really any aspect of these lessons that you think could be better/improved that would also be greatly appreciated as we’re still pretty new to this kind of stuff! [or at least I am zzz]
We're starting up a discord if people want to hang out while working on things or if you just would prefer to ask questions in real time there we figured it might be easier for some! Ask myself, chamber or errant for linkage if you're interested!
Happy coding. :)

Posted: Thu Nov 10, 2016 2:14 pm
by gigabyteTroubadour
oh, i think my post was moved to the other thread but I /outed for this :P

sorry guys!! (tho if you're going to post lessons in thread i might follow along for future reference)

Posted: Thu Nov 10, 2016 3:24 pm
by Accountant
/in student

Posted: Thu Nov 10, 2016 4:01 pm
by GuyInFreezer
Image

Posted: Thu Nov 10, 2016 4:47 pm
by xRECKONERx
Image

I think it'd be helpful to understand what we're coding. Like, what is the "Debug" command? Etc

Posted: Thu Nov 10, 2016 4:49 pm
by Cheetory6
We're mostly aiming to just get the result with the first lesson and to go into detail on exactly what the code is doing as we go more in-depth with coding in general in future lessons.

Posted: Thu Nov 10, 2016 4:50 pm
by chamber
In post 38, xRECKONERx wrote:Image

I think it'd be helpful to understand what we're coding. Like, what is the "Debug" command? Etc
We do intend to teach everything that's going on in this example eventually. But Everything is a lot. We wanted there to be some sense of accomplishment rather than here's 6 hours of us truly explaining everything you need to learn before you can do anything.

Expect it to be peppered into future lessons when knowing more about it becomes more useful.

In this instance, the Debug command is used to help debug your code, when you run into issues it can be useful to write things to the console about the state of the program so you can better figure out where and why it's failing.

Posted: Thu Nov 10, 2016 4:52 pm
by xRECKONERx
so Log is what tells it to print to console?

Posted: Thu Nov 10, 2016 4:52 pm
by chamber
Yes.

There is a very deep rabbit hole to better explain what's going on. For now trust that we will get there in time, and that this lesson was mostly about getting you comfortable working in unity a little bit.

Posted: Thu Nov 10, 2016 4:56 pm
by Sudo_Nym
This was fun, though a bit simple. Here's my code for SendMessage:
Spoiler:
using UnityEngine;
using System.Collections;

public class SendMessage : MonoBehaviour {

// Use this for initialization
void Start () {
Debug.Log("Hello World!");
Debug.Log(@"Please enjoy the following poem:
A hobo always goes and goes
He does not stop to change his clothes
He rides the rail that he has chose.
Water pours out from a hose!

Do not show me tramp or bum
Tramp may ride, and bum's a chum
But both beg from the other one
Kids, stop chewing bubble gum!

Neither works like hobo does
Carving coin and twisting fuzz
Into a pretty pair of gloves
The past tense of 'to be' is 'was'!

A hobo, he will never steal
Unless it is to get a meal
Or cash, or gems, or fur of seal
Some Japanese eat broiled eel!

But saddest: those who will not ride
At all, but stand and die inside
As world spins on and throws aside
The past, and hope, and faith, and pride
In one direction trains do glide
Not looking back, on windward side
Across the continent's divide
The hobo rides and rides and rides
I'll eat anything that's fried
--Mindbender Steve, The Appeal to Reason, 1916");
Debug.Log("Thank you.");

}

// Update is called once per frame
void Update () {

}
}

Posted: Fri Nov 11, 2016 4:52 pm
by Equinox
Image

Posted: Sat Nov 12, 2016 4:39 am
by Sotty7
Image

Times I thought I would be a little overwhelmed but the instructions were done well so I didn't get lost. A nice intro to it all I think.

Posted: Sun Nov 13, 2016 5:15 pm
by Errantparabola
Hi! personal issues have kept me from being able to keep up to date on this, but those have largely passed so I should be fully engaged in 2-3 days. thanks and apologies.

Posted: Thu Nov 17, 2016 10:23 am
by Firebringer
/in student
working on first week assignment now

Posted: Thu Nov 17, 2016 12:32 pm
by chamber
Spoiler: Introduction
In the previous lesson we used the following code:

Code: Select all

void Start () {
	Debug.Log("Hello world!");
}

In today's first lesson we will be covering one part of this in more detail. "Hello world!". If you were observant you may have found it strange that we had to put quotation marks around this, but not other parts of the code. This is because "Hello world!" represents a string value. This shouldn't mean anything to you yet if you are new to programming, so don't worry. For today's lesson I've provided code snippets for most of the examples, however I encourage you to type them yourself rather than copy-pasting them. This will help your familiarity going forward.


Spoiler: 2.01: Variables explained
Variables are a means of storing data for later use. They are one of the core pillars of programming. It may help you to think of a variable as a box.

Image

It has a name used to access the value, and the value that is stored. Variables come in different types, today we'll be handling 3 families of variables. Words, Numbers, and True/False (in programming called a Boolean). With the exception of Booleans, these are not typically grouped like this, and are only being done so now as a teaching tool. For Words your primary type of variable is a string. A string holds whatever characters you want it to, and is enclosed in ""s. An addition type is char, which is a single character. char's are enclosed in ''s.

If we go back to the program we made last week, we now know some of what we need to make a change.

Change

Code: Select all

void Start () {
	Debug.Log("Hello world!");
}

To

Code: Select all

void Start () {
        string message = "Hello world!";
	Debug.Log(message);
}


And run the program again. You should see the same message as last time.

As I said previously "Hello world!" is a string value. We know this because it's enclosed in ""s. What's new here is

Code: Select all

        string message = "Hello world!";


This has several parts which I will now break down.

'string': This is the type of the variable we wish to declare.
'message': This is the name of the variable we wish to declare, we can then use it in the future to represent the stored value.
'=': This is the assignment operator. This may be confusing for people with a math background. Thinking of it as a traditional equals sign can get you in trouble. It means set the value of what's on it's left side to the value of what is on it's right side.
'"Hello world!"': This is the value we assign to message using '=' the assignment operator.

At this point I encourage you to play around a bit, entering your own string values.

Above we declared and assigned the variable in the same line. This is common, but not the only way to do things. You may not know the value a variable will have at the time it's being declared. In such cases you can break it up

Code: Select all

        string message;
        message = "Hello world!";


Note that string is not repeated at the beginning of future references to message, only when it's first declared, and that you need to end each line with ";" the line terminator. If you are observant you'll notice that this isn't true of all code by looking at other parts in this file, but for now, everything you do inside of 'Start' will require it.

Try one final example to help understand variable assignment

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
}


At this point if you feel you don't understand variable assignment, please ask one of the teachers in discord.

That will cover strings for now, but as I said above, we are also covering Numbers, and booleans.


Spoiler: 2.02: More Types
There is a lot more going on with types for numbers than there were for strings and chars, and we wont be covering it exhaustively today. Primarily they are divided in 3 ways. First, whether the Number is an integer or a floating point (real). Second, the maximum and minimum sized number it can hold. And Third, whether it can hold negative values or not(signed).

The primary Type you will use for an interger is
int
. The primary type you will use for a floating point number is
double
.

An int is also known as an
int32
. This is because it can store 32 bits worth of data. It is signed, which means it can hold both negative and positive numbers. Because of this the maximum value it can hold is (2^31)-1 and the minimum value it can hold is -(2^31).
The first bit of the 32 being used to indicate whether it is odd or even.

A double holds 64 bits of data and is also signed. Because of the way a double stores data, it can store very large values, but is only precise to 15 or 16 digits.

Now lets try and use some new types of variables in our program.

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
        int number;
        number = 7;
        Debug.Log(number);
}


Now lets try a double

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
        double number;
        number = 7.0;
        Debug.Log(number);
}


The final variable Type we introduce in this lesson is a Boolean. A Boolean is either true or false. Up until now all of our programs have run from the top of 'Start' to the bottom of 'Start' in order. Boolean values are key in controlling and altering the flow of a program. We wont be doing so this lesson, but I wanted you to understand their significance.

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
        double number;
        number = 7.0;
        Debug.Log(number);
        bool isTrue = true;
        bool isFalse = false;
        Debug.Log(isTrue);
        Debug.Log(isFalse);
}


Take this Moment to ask in discord if you feel you don't understand anything.

Now that we know some basic variable types lets have some fun with them.

Think a bit about what you think these will do before running them.

Code: Select all

void Start () {
       int number1 = 1;
       int number2 = 1 + 1;
       number1 = number1 + number2;
       Debug.Log(number1);
}


Code: Select all

void Start () {
       int number1 = 1;
       int number2 = 1 + 1;
       number1 = number1 + number2;
       number2 = 5;
       Debug.Log(number1);
}


Spoiler: 2.03: Operators
Now that we have a basic grasp on variables, we are going to introduce and cover some basic operators. That sounds more scary than it is because we've already used one above +(addition). Some other operators are -(subtraction), *(multiplication), /(division), %(mod). For those that have been out of school for a while the % operator will return the remainder of a division operation. So 5%2 would be 1. These are collectively known as arithmetic operators. Most of those should work how you expect. However there is one big exception. / can have unexpected results for new programmers because if both sides of the operator are ints, the return value will also be an int. For example 5/2 would not be 2.5, it would be 2.

I don't have any structured exercises to take you through for these right now, but I suggest you play with them a bit on your own. When you are comfortable with them we can move on to some string operators.

The only string operation we are going to cover for now is concatenation. That's a big scary word, but it just means adding 2 or more strings together. When they are added the latter will be appended to the former. In c# the concatenation operator is also +.

Code: Select all

void Start () {
      string hello = "hello";
      string world = "world!";
      string helloworld = hello + world;
      Debug.Log(helloworld);
}


You'll note that the 2nd string was appended (added to the end of) the first string. However, we are missing a space between them. I did this intentionally because its an easy error to make, and wanted you guys thinking about it.

Code: Select all

void Start () {
      string hello = "hello";
      string world = "world!";
      string helloworld = hello + " " + world;
      Debug.Log(helloworld);
}


All better.

Finally for booleans we are going to cover the comparative operator(==), not (!), or(||), and (&&). We will cover these in more detail later, but I at least want to get them introduced to you now. == is used to compare two values and resolves to a boolean. So for instance 1 == 1 would resolve to true.

Code: Select all

void Start () {
      Debug.Log(1 == 1);
      Debug.Log(1 == 2);
}


The ! operator inverts the boolean value of anything its put in front of. For instance

Code: Select all

void Start () {
      Debug.Log(!(1 == 1));
      Debug.Log(!(1 == 2));
}


|| and && are used for more complex statements, for instance

Code: Select all

void Start () {
      Debug.Log((1 == 1) || (1 == 2));
      Debug.Log((1 == 1) && (1 == 2));
}


|| is true if either side is true, && is true only if both sides are true.



Spoiler: Challenges (not so challenging this week)
1 print the boolean true value to the screen using all of the different boolean operators we worked with. Don't just copy a previous example.
example:

Code: Select all

Debug.log((1==1) && !(1==2) || (1==1));

2 Same as above but false instead of true.
3 Try concatenating a string and an int or double. Print it to the screen.
4 Try the same with a string and a bool.
5 print the product of any 2 numbers.
6 print the maximum value of an int.

Posted: Thu Nov 17, 2016 4:46 pm
by GuyInFreezer
Spoiler: Challenges
Image