Presentation is loading. Please wait.

Presentation is loading. Please wait.

Starter activity – 10mins

Similar presentations


Presentation on theme: "Starter activity – 10mins"— Presentation transcript:

1 Starter activity – 10mins
Your code should look like this: Starter activity – 10mins package helloworld; class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } Using the windows start menu Open NetBeans Select File > New Project Select Java Application > Click Next Give the project the name “HelloWorld” > Click Finish Enter the code above and complete the Exercise 1 on the sheet - Writing your first java program

2 1. 2 Try this: Change the text "Hello World
1.2 Try this: Change the text "Hello World!" to say the same in French (Use google translate). Re-compile, run and see what happens.

3 1.2 Try this: Change the text "Hello World!" to say the same in French (Use google translate). Re-compile, run and see what happens.

4 Unit 20 Computer game platforms & technology – What’s left?
P3M3D3 Understand software technologies for game platforms Platform dependency, operating systems, game engines and languages for games and graphical API’s P4M4D4 Be able to connect and configure platforms and devices to enable gameplay Connect and configure: Gaming devices such as consoles and PC’s including internet access. Set up PC device drivers (graphics card, sound card, network interface controller) Install and configure games: Produce evidence of this taking place. Via checklists, photographs, video, portfolio , blogs.

5 Unit 20 – Computer Game Platforms & Technology – Software Technology
Platform dependency: dependent; independent Operating systems: for PC/Macintosh, eg Windows, Linux, Mac OS; for hand held, eg Windows CE, Palm OS; for mobile, eg Symbian OS (Nokia N-Gage), BREW, Mophun Drivers: soundcard driver; graphics card driver; network interface controller (NIC) Application software: interpreted languages for games (Java, J2ME, C#); compiled languages for games (C++); object-oriented (C++, C#, Java, J2SE, J2ME); scripting, eg Lingo, UnrealScript, QuakeC, Maya Embedded Language, ActionScript, JavaScript Graphical API: OpenGL; OpenGL ES; DirectX Sound API: OpenAL; Java Sound API Television: conditional access; iTV; ETV Unit 20 – Computer Game Platforms & Technology – Software Technology

6 Lesson Aims Learning outcomes
Introduction to understanding software technologies for game platforms Investigate one application software used to develop games Learning outcomes Know of some of the different application software used to develop games Understand the differences between compiled and interpreted languages Be able to create and understand basic Java syntax and vocabulary Be able to write a basic Java program

7 Application software for games:
Game Engines: Gamemaker, Unity and Unreal etc Languages for games Hybrid languages: Java, Python, C# Compiled languages: C, C++ Interpreted languages: PHP, JavaScript Game Engines and programming languages are intrinsically linked Examples of software/languages we can use to make games W

8 What is a programming language
A special computing based language that programmers use to develop software programs, scripts, instructions and games for computers and consoles to execute. Like all the spoken languages throughout the world there are many different programming languages

9 Focus today - Java We’re going to look briefly at the different languages and engines we can use to make games over the next few weeks. Today Java We will also look at C++ Java is especially popular for mobile gaming particularly on android devices. Most Play Store app’s are built using it. Java is NOT the same as javascript Android uses the syntax and structure to Java but is compiled differently using googles own interpreter and compiler. Shares similarity's to C# which is used by Unity

10 Java Program Structure
In the Java programming language: A program is made up of one or more classes A class contains one or more methods A method contains program statements A Java application always contains a method called main main is the first method called when a Java application starts

11 Java Program Structure
// comments about the class public class MyProgram { } class header class body Comments can be placed almost anywhere

12 Java Program Structure
// comments about the class public class MyProgram { } // comments about the method public static void main (String[] args) { } method header method body

13 Variables A variable in programming is a useful container which a value can be stored in and used within the program. The stored value can then be changed (vary) throughout the program as it executes its instructions. A variable is created by writing a variable declaration in the program specifying the type of data that the variable can contain.

14 2. 1 Try this: Enter the following code
2.1 Try this: Enter the following code. This code will create a variable and then modify it while outputting both values: class FirstVariable { public static void main(String[] args) { String message = "Initial value"; System.out.println( message ); message = "Modified value"; }

15 3. Data Types The most frequently used data types when declaring a variable are shown below: Data type: Description: Example: char A single Unicode character 'a' String Any number of Unicode characters "This is my String" Int An integer number, between billion and billion 1000 float A floating-point number, with a decimal point f boolean A logical value of either true or false true Try this 3.1: Let’s create a program that creates, initializes and outputs variables of all the common data types

16 4. Creating constants Constants allow you to declare a variable that cannot be changed. Using the modifier "final" keyword before a data type lets the program know that no further changes are allowed. Convention dictates that we use capital letters when declaring constants. Try this 4.1 Using the code on the sheet let’s create a program that uses Constants Try this 4.2 Add a statement that attempts to change the value of a constant, recompile and see what happens.

17 After break exercise – 10mins
What language do the following use: Gamemaker Unity Unreal Engine Android SDK IOS SDK

18 5.1 Try this: Add comments to your constants program
It is good practice when coding to leave comments to explain each section of your code. This helps yourself and other people to understand your code. If you'd like to display code over multiple lines use /* and */ writing your comments in-between. If you'd like to create a single line comment then start with //. Comments are completely ignored by the compiler. 5.1 Try this: Add comments to your constants program

19 6. Exercises - A

20 6. Exercises - B

21 6. Exercises - C

22 After break exercise – 10mins
What language do the following use: Gamemaker: Unity: Unreal Engine: Android SDK: IOS SDK:

23 Application software:
Game Engines: Gamemaker, Unity and Unreal Hybrid languages: Java, Python, C# Compiled languages: C, C++ Interpreted languages: PHP, JavaScript

24 What are…. Compiled vs Interpreted languages
A compiled language is when a person writes the code the compiler separates the file and the end result is an executable file. Basically, owner keeps the source code. Interpreted languages are different because the code is not compiled first hand. Instead, a copy is given to another machine and that machine interprets it. An example is JavaScript (which is used everywhere online). Code Compile Code Run Compiled Code Code Run code

25

26 interpreted languages for games (PHP, JavaScript);
Read and processed by another program(Interpreter). Runs on the fly. Does not need to be compiled first. Not turned into Machine code. Language must be installed on any machine that needs to run the script. Will run more slowly than compiled code because it has to actively perform the step of turning the code into something the machine can handle on the fly. With interpreted code you open the program, change it and it is ready to go.

27 Example interpreted Python code
CODE: print ("hello world") TO RUN: python helloworld.py This would display the words “Hello World”. Simply runs without compiling. Code stored in file ending in .py Using compatible software Run code/file

28 compiled languages for games (C, C++);
Compiled code runs faster than interpreted code. It is not worked out on the fly.  Compiling converts the code to machine code/binary It is checked for errors whilst it is being compiled. Errors are then reported and can be fixed before re-compiling. A C program compiled on a windows computer cannot be copied to a Linux computer and run. You would have to compile the program again using a C compiler on a Linux computer.

29 Example of Compiled Code
This would display the words “Hello World”. Will not work without compiling first. Compiling turns the C code into machine code. CODE: #include <stdio.h> int main() {         printf("Hello World"); } COMPILE: gcc helloworld.c -o hello RUN: ./hello Code Compile Code Run Compiled Code

30 Compiled code is turned to Machine code/Binary

31 7. Java - Accepting Input from a User
One of the strengths of Java is the huge libraries of code available to you. This is code that has been written to do specific jobs. All you need to do is to reference which library you want to use, and then call a method into action. One really useful class that handles input from a user is called the Scanner class. Try this: Input the code provided using the scanner class

32 8 Scanner Exercise 1 Change the program so that it also adds the users’ age. Use the following steps: Create an int variable called “Age”. Ask for the users age Use the code age = keyboard.nextInt(); to get the int value. Output the users Name and Age on the same line

33 8 Scanner Exercise 2 Create a new program and ask the user for their name. Then display their name to prove that you can recall it. Ask them for their age. Then display that. Finally, ask them for how much they earn and display that. You should use the most appropriate data type for each variable

34 8 Scanner Exercise 3 Create a new program and ask the user for several pieces of information, and display them on the screen afterward as a summary. First name Last name Date of birth Current Qualification Student id number You must use the most appropriate type for each variable and not just Strings for everything.

35 What we’ve learned – End of lesson
Discussed the remainder of the unit Gained an understanding of what application software for games are. Learned of different ways of making video games Learned the difference between interpreted and compiled languages Learned the basic syntax and the vocabulary of Java You’re able to write basic Java programs

36 Next week Continuing our investigation into programming languages and software


Download ppt "Starter activity – 10mins"

Similar presentations


Ads by Google