Tag Archives: world

Introduction to programming in Java

Welcome to the Java programming tutorial series. In this tutorial, I will show you how to download the Java SDK and Netbeans IDE so you can begin coding in Java. You will also learn how to write your very first program in Java – a ‘Hello world’ program.

Watch the video below and then scroll down for the links to the Java SDK and Netbeans IDE downloads and to view the sample code for the example shown in the video.

Downloads

All downloads are available for Windows, Mac and Linux

Sample code

Here is the sample Java code for this tutorial. Keep in mind that the project name in the video example was HelloWorld and so the package in the sample code is also called helloworld.

package helloworld;
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
    
}

Hello world (in C#)

This tutorial is an introduction to Xamarin Studio and the C# programming language. In this video I explain how to create a new solution in Xamarin Studio and cover some of the basics of the C# language. We will create our first program in C# and develop skills in the language before moving on to creating mobile apps.

Watch the video below and then scroll down to see the sample code. Make sure you check out the C# code reference here.

Sample C# code

This code is used in a solution and project both called MyCSharpApp created in Xamarin Studio. If you use this code, make sure your solution, project and namespace are called MyCSharpApp. The code also contains comments (after the double forward slashes) to explain what each statement in the code does.

using System;

namespace MyCSharpApp
{
  class MainClass
  {
    public static void Main (string[] args)
    {
      Console.WriteLine ("Hello, this is my first C# app"); // this displays a message in console
      Console.ReadLine (); // this waits until the user enters something
    }
  }
}

Next tutorial: Variables and strings in C#

Adding skyboxes to your 3D game environment

This tutorial explains how to add skyboxes to your 3D game project in Unity. A skybox is basically a large box that surrounds your world. It is a 6-sided cube that has inward-textures which make it appear round. You can create your own skyboxes or use existing skyboxes.

In this tutorial, we will use existing skyboxes made by others available for free on the Unity Assets Store. The links for these asset packages are also included in this tutorial (scroll down the page to find these links). The images below show examples of free skyboxes used in a game environment. You can assign skyboxes for an entire scene or for individual cameras so that the world can appear different to different viewers. Scroll down to watch the video.

A dusk/dawn skybox
A dusk/dawn skybox
A sunny skybox
A sunny skybox
An overcast skybox
An overcast skybox

Watch the video below to see how you can use skyboxes in your own 3D game project with Unity.

You can access free asset packages containing skyboxes from the links below:

Adding terrain, trees, grass and water to your game

This tutorial explains how to add terrain to your 3D game environment in Unity. You will also learn how to edit the terrain and add textures to it, as well as how to add trees, shrubs, grass and water to the terrain.

To add textures, trees, grass and water to your terrain, you will need to import assets into your Unity project – this is also covered in the video. Scroll down the page to watch the video.

A basic terrain with textures, trees and water
A basic terrain with textures, trees and water (in Scene view)
A basic terrain being navigated in Play mode (using lower quality preview settings)
A basic terrain being navigated in Game view (using lower quality preview settings)

After watching this video, you will see just how easy it is to add terrain to your game environment like in the examples above.

If you find that Unity is running very slow, then reduce the amount of trees and grass in the environment. Lots of grass and trees can make Unity run slower. Note that the environment will not be fully rendered in Scene or Game view so the quality will not appear as high as it will be in the fully rendered game.

The image below shows how grass is rendered in front of a player in first person view.

Grass rendered in first person view.
Grass rendered in first person view.

Hello World

The code below can be copied to a HTML file. The HTML code contains JavaScript code which will basically display a “Hello world” message in the browser window. The code also shows examples of using single-line and multi-line comments. Simply copy and paste the code snippet into a text editor and save the file as yourfilename.html

You can also watch the video explaining how to get started with JavaScript here.

<!DOCTYPE html>
<html lang="en"
<head>
 <meta charset="utf-8"/>
 <title>JavaScript intro</title>
 
 <script type="text/javascript">
 
 document.write("Hello world");
 
 // This is a single-line comment
 
 /*
 This is a multi-line comment.
 Line 9 prints a simple message using a write statement.
 The semi-colon means that is the end of the statement. It is placed at the end of the line.
 */
 
 // To check errors you can use Browser Console (Firefox) or Console (Chrome and IE).
 
 </script>
 
</head>
<body>
 
 
</body>
</html>