Unity 3D is a popular multi-platform game engine that has been used for over 10 years. It uses scenes to organize game levels and objects. Gameplay is created using game objects, components, transforms, lights, cameras, inputs, and triggers. Common tasks for a beginner project include creating a maze with a movable character controller and trigger that removes the floor.
A game is a structured activity involving goals, rules, conflict, interaction and rewards. There are different types of video games like arcade, computer, console and mobile games. Common game genres include action, adventure, puzzle, role playing, strategy and simulation games. The document then provides examples and guidelines for modeling, texturing and other aspects of the game development process.
This document provides an overview of developing a Silverlight game, including designing levels and storyboards, implementing game logic for player movement and collision detection, developing the game using tools like Visual Studio and Expression Blend, and organizing code using the MVC pattern. It also describes techniques for animating game elements like scrolling the game board and frame-by-frame animations, as well as managing sounds. The game is divided into modular XAP files that are downloaded and loaded dynamically.
This document provides an overview of the Unity game engine. It describes what Unity is, how to install it, and its main features. Unity can be used to create both 2D and 3D games and supports multiple platforms. It includes tools for graphics, physics, scripting, multiplayer networking, audio, animation, navigation, assets, and building games for different platforms. C# or JavaScript can be used for scripting. Visual Studio is recommended for script editing.
This document provides instructions for setting up a space shooter game in Unity. It describes creating a new Unity project, importing asset packages, configuring scenes and game objects, adding scripts, and testing gameplay functionality. Key steps include setting up the player ship game object with rigidbody and collider components, configuring lighting and cameras, adding a background, and writing scripts to control ship movement and fire projectiles. The goal is to implement the basic mechanics of a space shooter game in Unity according to an online tutorial.
This document provides an overview of the Unity game engine and game development process using Unity. It discusses Unity basics like scenes, game objects, prefabs, and scripting. It also covers installing Unity, system requirements, and building games for different platforms. The document is intended as an introductory guide for using Unity for game development.
The document provides details on Luis Vazquez's workflow for creating levels in a 2D game engine. It describes how he created a player sprite and object, including designing the sprite visually and coding movement controls. It also covers adding a room for testing, including setting movement boundaries. Backgrounds were added by importing images and setting parallax scrolling. Finally, the document mentions plans to create a particle system to simulate engine flames from the spaceship sprite.
XNA is a framework for creating 2D and 3D games for Windows Phone 7. It includes tools for game development and resource management. The XNA framework provides classes to create gameplay and manage game resources like textures, models, and scripts. When an XNA game runs, it loads resources at start up, then repeatedly updates the game world based on input and draws the updated world. The core methods that drive this cycle are LoadContent, Update, and Draw. LoadContent loads resources. Update handles game logic and state changes. Draw renders the current game state to the screen.
Unity3D is a full 3D engine that supports many platforms and has powerful customization tools. It features a 3D engine, cross-platform support for Windows, Mac, web, iOS, Android, and more. Unity3D uses extensible plug-in architectures and scripting languages like C# for game logic.
The document provides an overview of a presentation on Unity game engine programming. It introduces the presenter and their background and experience. It then outlines the topics to be covered, including Unity engine API model, scripting languages like C# and JavaScript, Unity game object structure, and examples. It lists some advanced programming topics that may not have enough time to cover. It encourages attendees to learn programming on their own and notes the presentation is subject to time limitations. It provides a disclaimer and says to stay tuned for future Unity workshop announcements.
The document describes how to create a 2D platformer game in Unity, including:
1) Adding background animations and music
2) Creating and controlling the player character
3) Spawning random enemies
4) Implementing a health bar UI to display the player's health
The document describes a space shooter game being developed using the XNA framework. The game will use trackpad controls to provide an immersive experience for laptop users. It is being developed by a team of students and will feature top notch graphics, multiple levels of difficulty, scoring, time tracking, and collision detection. The document outlines the game's design, functions like initialize, load content, unload content, update, and draw. It also discusses the XNA framework, collision detection using bounding spheres, and the team's step-by-step implementation process in three phases.
1. The document discusses various aspects of user input and frame animation in libGDX, including touch input, keyboard input, gestures, the accelerometer, and sprite animation.
2. It explains how to set up input processing using InputProcessor and GestureDetector, and how to read touch, keyboard, and accelerometer values.
3. It also provides examples of creating sprite animations by splitting textures into frames and using the Animation class.
Cocos2d is a well known open source software framework on game industry. It is is a 2D game framework built upon the OpenGL ES API’s.
In this session, I will talk about a hierarchical structures of an Cocos2d node and scenes. Also Cocos2d Graphic User Interface, Physical System, Audio, Particle System and Scene Transition technique will be shown. Finally this session will show various branches of Cocos2d open source projects including Cocos2d-x, Cocos2d-Swift, Cocos2d-html5, and Cocos2d-xna.
This document provides an overview of using the XNA framework to create games for Windows Phone 7. It discusses that XNA is a framework for writing 2D and 3D games. It includes tools for game production and resource management. The document explains how to load game assets, create sprites, and use the XNA game class methods like LoadContent, Update, and Draw to initialize resources, update the game world, and draw to the screen. It provides an example of creating a simple game that draws a texture and moves it by updating its rectangle position in the Update method.
The Ring programming language version 1.2 book - Part 36 of 84
The document describes a game engine for 2D games created using Ring. It has the following layers:
1) Games layer uses declarative programming to create games.
2) Game engine classes layer uses object-oriented programming for classes like Game, Sprite, etc.
3) Interface layer hides differences between graphics libraries (Allegro, SDL) for a consistent API.
4) Graphics library bindings generate C code from configuration files to interface with Allegro and SDL.
The engine provides classes for games, objects, sprites, text, animation and sound. Examples show creating a game window, drawing text, playing sounds, and animating sprites. The engine handles input and updating the game loop.
El documento describe los principales grupos étnicos de las tres regiones de Ecuador: la sierra, la costa y el oriente. En la sierra se encuentran los quichuas y los cañaris. En la costa habitan los montubios y los afroecuatorianos. Y en el oriente viven los shuar, los achuar, los zaparos y los waorani.
According to HTTPArchive.org the average web page is now larger than the original DOOM installation application. Today's obese web is leading to decreased user satisfaction, customer engagement and increased cost of ownership. Research repeatedly tells us customers want faster user experiences. Search engines reward faster sites with better rankings. Small, fast sites are cheaper to develop, maintain and operate.
- Why has the web become obese?
- What actions can developers and stakeholders do to combat their morbid obesity?
- Are these actions expensive or hard to implement?
This session reviews what customers want and how to identify your web site's love handles. More importantly you will learn simple techniques to eliminate the fat and create a healthy, maintainable, affordable web development lifestyle that produces the user experiences your customers want to engage with over and over.
The Ring programming language version 1.5.4 book - Part 48 of 185Mahmoud Samir Fayed
This chapter discusses creating a game engine for 2D games in Ring. The project has several layers: a games layer that uses declarative programming to create games, game engine classes that use object-oriented programming, an interface layer that hides the details of the graphics libraries, and graphics library bindings that were created using procedural programming. The game engine includes classes like Game, Sprite, Text, and Sound that can be used to easily create 2D games. Examples are provided of simple games created using the engine.
The document provides information about game development using Unity. It discusses concepts like game engines, Unity interface and components, character control, game design, gameplay, basic components, enemy AI, memory management and optimization. It also covers topics such as the anatomy of video games, the game development process, 2D and 3D art, what Unity is and why to use it, its interface and execution order of event functions. Additionally, it summarizes Mecanim workflow, asset preparation, terrain editing, adding water and skyboxes, importing assets, lightmapping, fog, game design, and enemy pathfinding using waypoints.
Unity 3d is a popular game engine used to design games for mobiles,xbox etc.
It was developed by unity technologies and it was useful to those who want to start game designing
Unity 3D is a popular multi-platform game engine that has been used for over 10 years. It uses scenes to organize game levels and objects. Gameplay is created using game objects, components, transforms, lights, cameras, inputs, and triggers. Common tasks for a beginner project include creating a maze with a movable character controller and trigger that removes the floor.
A game is a structured activity involving goals, rules, conflict, interaction and rewards. There are different types of video games like arcade, computer, console and mobile games. Common game genres include action, adventure, puzzle, role playing, strategy and simulation games. The document then provides examples and guidelines for modeling, texturing and other aspects of the game development process.
This document provides an overview of developing a Silverlight game, including designing levels and storyboards, implementing game logic for player movement and collision detection, developing the game using tools like Visual Studio and Expression Blend, and organizing code using the MVC pattern. It also describes techniques for animating game elements like scrolling the game board and frame-by-frame animations, as well as managing sounds. The game is divided into modular XAP files that are downloaded and loaded dynamically.
This document provides an overview of the Unity game engine. It describes what Unity is, how to install it, and its main features. Unity can be used to create both 2D and 3D games and supports multiple platforms. It includes tools for graphics, physics, scripting, multiplayer networking, audio, animation, navigation, assets, and building games for different platforms. C# or JavaScript can be used for scripting. Visual Studio is recommended for script editing.
This document provides instructions for setting up a space shooter game in Unity. It describes creating a new Unity project, importing asset packages, configuring scenes and game objects, adding scripts, and testing gameplay functionality. Key steps include setting up the player ship game object with rigidbody and collider components, configuring lighting and cameras, adding a background, and writing scripts to control ship movement and fire projectiles. The goal is to implement the basic mechanics of a space shooter game in Unity according to an online tutorial.
This document provides an overview of the Unity game engine and game development process using Unity. It discusses Unity basics like scenes, game objects, prefabs, and scripting. It also covers installing Unity, system requirements, and building games for different platforms. The document is intended as an introductory guide for using Unity for game development.
The document provides details on Luis Vazquez's workflow for creating levels in a 2D game engine. It describes how he created a player sprite and object, including designing the sprite visually and coding movement controls. It also covers adding a room for testing, including setting movement boundaries. Backgrounds were added by importing images and setting parallax scrolling. Finally, the document mentions plans to create a particle system to simulate engine flames from the spaceship sprite.
XNA is a framework for creating 2D and 3D games for Windows Phone 7. It includes tools for game development and resource management. The XNA framework provides classes to create gameplay and manage game resources like textures, models, and scripts. When an XNA game runs, it loads resources at start up, then repeatedly updates the game world based on input and draws the updated world. The core methods that drive this cycle are LoadContent, Update, and Draw. LoadContent loads resources. Update handles game logic and state changes. Draw renders the current game state to the screen.
Unity3D is a full 3D engine that supports many platforms and has powerful customization tools. It features a 3D engine, cross-platform support for Windows, Mac, web, iOS, Android, and more. Unity3D uses extensible plug-in architectures and scripting languages like C# for game logic.
The document provides an overview of a presentation on Unity game engine programming. It introduces the presenter and their background and experience. It then outlines the topics to be covered, including Unity engine API model, scripting languages like C# and JavaScript, Unity game object structure, and examples. It lists some advanced programming topics that may not have enough time to cover. It encourages attendees to learn programming on their own and notes the presentation is subject to time limitations. It provides a disclaimer and says to stay tuned for future Unity workshop announcements.
The document describes how to create a 2D platformer game in Unity, including:
1) Adding background animations and music
2) Creating and controlling the player character
3) Spawning random enemies
4) Implementing a health bar UI to display the player's health
The document describes a space shooter game being developed using the XNA framework. The game will use trackpad controls to provide an immersive experience for laptop users. It is being developed by a team of students and will feature top notch graphics, multiple levels of difficulty, scoring, time tracking, and collision detection. The document outlines the game's design, functions like initialize, load content, unload content, update, and draw. It also discusses the XNA framework, collision detection using bounding spheres, and the team's step-by-step implementation process in three phases.
1. The document discusses various aspects of user input and frame animation in libGDX, including touch input, keyboard input, gestures, the accelerometer, and sprite animation.
2. It explains how to set up input processing using InputProcessor and GestureDetector, and how to read touch, keyboard, and accelerometer values.
3. It also provides examples of creating sprite animations by splitting textures into frames and using the Animation class.
Cocos2d is a well known open source software framework on game industry. It is is a 2D game framework built upon the OpenGL ES API’s.
In this session, I will talk about a hierarchical structures of an Cocos2d node and scenes. Also Cocos2d Graphic User Interface, Physical System, Audio, Particle System and Scene Transition technique will be shown. Finally this session will show various branches of Cocos2d open source projects including Cocos2d-x, Cocos2d-Swift, Cocos2d-html5, and Cocos2d-xna.
This document provides an overview of using the XNA framework to create games for Windows Phone 7. It discusses that XNA is a framework for writing 2D and 3D games. It includes tools for game production and resource management. The document explains how to load game assets, create sprites, and use the XNA game class methods like LoadContent, Update, and Draw to initialize resources, update the game world, and draw to the screen. It provides an example of creating a simple game that draws a texture and moves it by updating its rectangle position in the Update method.
The Ring programming language version 1.2 book - Part 36 of 84Mahmoud Samir Fayed
The document describes a game engine for 2D games created using Ring. It has the following layers:
1) Games layer uses declarative programming to create games.
2) Game engine classes layer uses object-oriented programming for classes like Game, Sprite, etc.
3) Interface layer hides differences between graphics libraries (Allegro, SDL) for a consistent API.
4) Graphics library bindings generate C code from configuration files to interface with Allegro and SDL.
The engine provides classes for games, objects, sprites, text, animation and sound. Examples show creating a game window, drawing text, playing sounds, and animating sprites. The engine handles input and updating the game loop.
El documento describe los principales grupos étnicos de las tres regiones de Ecuador: la sierra, la costa y el oriente. En la sierra se encuentran los quichuas y los cañaris. En la costa habitan los montubios y los afroecuatorianos. Y en el oriente viven los shuar, los achuar, los zaparos y los waorani.
According to HTTPArchive.org the average web page is now larger than the original DOOM installation application. Today's obese web is leading to decreased user satisfaction, customer engagement and increased cost of ownership. Research repeatedly tells us customers want faster user experiences. Search engines reward faster sites with better rankings. Small, fast sites are cheaper to develop, maintain and operate.
- Why has the web become obese?
- What actions can developers and stakeholders do to combat their morbid obesity?
- Are these actions expensive or hard to implement?
This session reviews what customers want and how to identify your web site's love handles. More importantly you will learn simple techniques to eliminate the fat and create a healthy, maintainable, affordable web development lifestyle that produces the user experiences your customers want to engage with over and over.
This paper discusses how the effective usage of Big Data Analytics can revolutionize energy sustainability initiatives for retailers, driving consumption pattern analysis, establishing efficiency blueprints and supporting maintenance efforts. Indeed, Big Data is the harbinger of an efficient tomorrow, bolstering the retailer’s fiscal as well as competitive repute in the market, combined with the augmentation of savings potential.
Brazil has a population of over 201 million people and its official language is Portuguese. It has diverse wildlife including over 3000 freshwater fish and is home to the largest rainforest in the world, the Amazon Rainforest, which contains 10% of the planet's known species and is inhabited by indigenous tribes.
This document is an introduction to a book titled Junior Skill Builders: Word Power in 15 Minutes a Day. The introduction provides an overview of the book's content and structure. It is designed to help readers build their vocabulary through 30 lessons, with each lesson intended to take 15 minutes to complete. Completing all the lessons over a month will significantly increase the reader's "word power," or vocabulary. The introduction explains how completing the lessons and exercises in the book will strengthen the reader's vocabulary in an efficient manner.
ElegantJ BI provides business intelligence software for mining companies. It offers speed, reliability, security, and convenience. It addresses key challenges such as connecting disparate data sources, consolidating data, and data security in reports. The software provides performance management through key performance indicators for metrics like production, revenue, and fraud management. It has a simple architecture that is browser-based, device independent, and requires no special skills to use.
Este documento describe los fundamentos del péndulo simple. Explica que un péndulo simple consiste en una partícula suspendida de un punto fijo por un hilo inextensible. Describe que el péndulo oscila en una trayectoria circular y las fuerzas que actúan sobre él, como la gravedad y la tensión del hilo. También explica las ecuaciones del movimiento en las direcciones radial y tangencial y cómo se conserva la energía del péndulo. Finalmente, menciona algunas aplicaciones de los péndulos en la ingeniería civil y con
This revision presentation provides an overview of the marketing planning process including a brief description of each stage in marketing planning together with discussion of the role of the marketing budget.
This document provides instructions for enhancing a basic first person shooter (FPS) game by adding additional weapon types, damage systems, and enemies. It describes adding a rocket launcher weapon that allows switching between weapons, includes a reload time and ammo count. Instructions are given for creating the rocket launcher model and script to fire rockets on input. The rocket is then created with its own model, rigidbody, and smoke trail particle effect. Finally, the rocket and its components are saved as a prefab that can be instantiated as projectiles from the rocket launcher.
This document provides an introduction to scripting in Unity, covering the basics of scripting fundamentals like naming conventions, player input, connecting variables, and accessing components between scripts. The tutorial uses JavaScript examples to demonstrate how to write scripts to move a main camera based on player input, create a spotlight that follows the camera, and access components between scripts to make the spotlight look at a cube when the jump button is pressed.
Getting Started.docx - Unreal Tournament 3 Bots for .NETbutest
The document provides instructions for creating a basic bot for the game Unreal Tournament 3 using C# and Visual Studio. It discusses setting up the bot with a name and appearance, making it move towards navigation points on the map, shoot at locations, and react to events like spawning or bumping into walls. The document recommends improving the bot's logic by adding states and reacting intelligently to items and other bots to make it a more skilled player.
This document discusses event-driven programming and graphical user interfaces (GUIs) using Swing/AWT in Java. It provides an overview of key GUI concepts like components, containers, layout managers, and events. It explains how to create basic GUI elements like frames and buttons. It also demonstrates how to write an event listener as a nested class to handle button click events and update the GUI in response.
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
Working with Layout Managers. Notes: 1. In part 2, note that the Game class inherits from
JPanel. Therefore, the panel you are asked to add to the center of the content pane is the \"game\"
object. 2. In part 4, at the end of the function, call validate(). This is not mentioned in the book,
but it is mentioned in the framework comments.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Game extends JPanel
{
private JButton [][] squares;
private TilePuzzle game;
public Game( int newSide )
{
game = new TilePuzzle( newSide );
setUpGameGUI( );
}
public void setUpGame( int newSide )
{
game.setUpGame( newSide );
setUpGameGUI( );
}
public void setUpGameGUI( )
{
removeAll( ); // remove all components
setLayout( new GridLayout( game.getSide( ),
game.getSide( ) ) );
squares = new JButton[game.getSide( )][game.getSide( )];
ButtonHandler bh = new ButtonHandler( );
// for each button: generate button label,
// instantiate button, add to container,
// and register listener
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j] = new JButton( game.getTiles( )[i][j] );
add( squares[i][j] );
squares[i][j].addActionListener( bh );
}
}
setSize( 300, 300 );
setVisible( true );
}
private void update( int row, int col )
{
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j].setText( game.getTiles( )[i][j] );
}
}
if ( game.won( ) )
{
JOptionPane.showMessageDialog( Game.this,
\"Congratulations! You won!\ Setting up new game\" );
// int sideOfPuzzle = 3 + (int) ( 4 * Math.random( ) );
// setUpGameGUI( );
}
}
private class ButtonHandler implements ActionListener
{
public void actionPerformed( ActionEvent ae )
{
for( int i = 0; i < game.getSide( ); i++ )
{
for( int j = 0; j < game.getSide( ); j++ )
{
if ( ae.getSource( ) == squares[i][j] )
{
if ( game.tryToPlay( i, j ) )
update( i, j );
return;
} // end if
} // end inner for loop
} // outer for loop
} // end actionPerformed method
} // end ButtonHandler class
} // end Game class
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class NestedLayoutPractice extends JFrame
{
private Container contents;
private Game game;
private BorderLayout bl;
private JLabel bottom;
// ***** Task 1: declare a JPanel named top
// also declare three JButton instance variables
// that will be added to the JPanel top
// these buttons will determine the grid size of the game:
// 3-by-3, 4-by-4, or 5-by-5
// Part 1 student code starts here:
// Part 1 student code ends here.
public NestedLayoutPractice()
{
super(\"Practicing layout managers\");
contents = getContentPane();
// ***** Task 2:
// instantiate the BorderLayout manager bl
// Part 2 student code starts here:
// set the layout manager of the content pane contents to bl:
game = new Game(3); // instantiating the GamePanel object
// add panel (game) to the center of the content pane
// Part 2 student code ends here.
bottom = new JLabel(.
Second chapter of the lecture Unreal Engine Basics taught at SAE Institute Hamburg.
- Getting familiar with the Unreal Level Editor
- Learning how to bind and handle player keyboard and mouse input
- Understanding character movement properties and functions
This document discusses teaching game development using mini-games to teach programming and design concepts. It provides an overview of setting up the development environment and tools, basic game programming concepts like cameras and matrices, and approaches for simple games like Pong to teach core mechanics.
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...DroidConTLV
SurfaceViews allow drawing to a separate thread to achieve realtime performance. Key aspects include:
- Driving the SurfaceView with a thread that locks and draws to the canvas in a loop.
- Using input buffering and object pooling to efficiently process touch/key events from the main thread.
- Employing various timing and drawing techniques like fixed scaling to optimize for performance. Managing the SurfaceView lifecycle to ensure the drawing thread starts and stops appropriately.
Third chapter of the lecture Unreal Engine Basics taught at SAE Institute Hamburg.
- Learning how to expose class fields and functions to blueprints
- Writing basic Unreal gameplay code, such as spawning actors, accessing components and listening for events
- Getting familiar with gameplay concepts in the context of Unreal, such as damage and collision
This document summarizes a presentation about the Unity game development platform. It introduces Unity as a game engine that integrates tools for creating 3D and 2D content across platforms. It describes Unity's main components, including the game engine, editor tools, asset store, and support for multiple platforms. It provides screenshots explaining Unity's interface and gives examples of creating a simple space shooter game in Unity, including importing assets, scripting enemy behavior, using prefabs, and adding collisions and a game over scene.
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...Andrey Karpov
One of the most relevant scenarios for using the PVS-Studio analyzer is its integration into CI systems. Even though a project analysis by PVS-Studio can already be embedded with just a few commands into almost any continuous integration system, we continue to make this process even more convenient. PVS-Studio now supports converting the analyzer output to the TeamCity format-TeamCity Inspections Type. Let's see how it works.
This document provides an introduction to scripting with Unity using Javascript. It aims to teach the fundamentals of scripting through a tutorial that has the user write scripts to control player input and movement, connect variables, access components, instantiate objects, and use debugging techniques. The tutorial is estimated to take 2 hours to complete and covers topics like naming conventions, writing scripts to move a player camera using input, controlling movement speed with delta time, connecting variables via the inspector, making an object follow another, accessing components from other scripts, instantiating prefabs, and using Debug.Log and private variables for debugging.
This document provides an introduction to scripting with Unity using Javascript. It aims to teach the fundamentals of scripting through a tutorial that has the user write scripts to control a player camera and spawn objects. The summary covers:
1. The tutorial introduces scripting in Unity using Javascript and covers naming conventions, connecting variables to assign them via the GUI, accessing other components, and instantiating objects at runtime.
2. Early scripts have the player move the main camera using keyboard input and add a spotlight that follows it.
3. Debugging techniques like Debug.Log() and exposing private variables are demonstrated to help troubleshoot scripts.
This document provides an introduction to scripting with Unity using Javascript. It aims to teach the fundamentals of scripting through a tutorial that has the user write scripts to control player input and movement, connect variables via the GUI, access components from other scripts, instantiate game objects, and use debugging techniques like Debug.Log(). The tutorial is estimated to take 2 hours to complete and covers important concepts like naming conventions, using Time.deltaTime to control movement speed, and exposing variables to tweak values in the inspector.
This document provides an overview of how to program character movement for a game similar to EVAC-CITY. It discusses creating an empty player object with a mesh filter and renderer. A material is applied using a sprite sheet texture. A rigidbody and capsule collider are added to enable physics-based movement. A script is created to handle input and movement. The script determines if the object is a player or AI controlled using a boolean, and has functions for finding player or AI input to determine movement each frame. Pointers are added to access the player and main camera game objects.
I am Burrows N. I am an Operating System Assignment Expert at programminghomeworkhelp.com. I hold a PhD. in Programming from, University Of Chicago, USA. I have been helping students with their homework for the past 4 years. I solve assignments related to Operating systems.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.
You can also call on +1 678 648 4277 for any assistance with Operating System Assignments.
This document provides instructions for building a simple toy UNIX-like operating system from scratch. It covers setting up the development environment with tools like GCC, NASM and an emulator. It then explains how to write a bootloader and kernel code in C and Assembly. Key concepts covered include the Global Descriptor Table (GDT) for memory segmentation and privilege levels, the Interrupt Descriptor Table (IDT) for registering interrupt handlers, and writing a basic text mode monitor for output. The document is intended as a tutorial for learning operating system development fundamentals.
1. The document describes the initialization process of SurfaceFlingerService in Android.
2. SurfaceFlinger is instantiated which creates the main SurfaceFlinger instance. This triggers the initialization of various core Android services.
3. The main display is initialized by creating a DisplayHardware instance and a graphic plane for the display. Shared memory is allocated to share display information.
Modify the bouncing ball example demonstrated/tutorialoutletCleasbyz
FOR MORE CLASSES VISIT
tutorialoutletdotcom
COIS 2240 Assignment#3 Question#1
Modify the bouncing ball example demonstrated in class to include a rectangle as shown in the
figure here: The width of the rectangle should be equal to radius*4, while the height should be equal to the
radius.
Similar to Introduction to Game Programming: Using C# and Unity 3D - Chapter 7 (Preview) (20)
Cultural Shifts: Embracing DevOps for Organizational TransformationMindfire Solution
Mindfire Solutions specializes in DevOps services, facilitating digital transformation through streamlined software development and operational efficiency. Their expertise enhances collaboration, accelerates delivery cycles, and ensures scalability using cloud-native technologies. Mindfire Solutions empowers businesses to innovate rapidly and maintain competitive advantage in dynamic market landscapes.
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsEstuary Flow
Unlock the full potential of your data by effortlessly migrating from PostgreSQL to Snowflake, the leading cloud data warehouse. This comprehensive guide presents an easy-to-follow 8-step process using Estuary Flow, an open-source data operations platform designed to simplify data pipelines.
Discover how to seamlessly transfer your PostgreSQL data to Snowflake, leveraging Estuary Flow's intuitive interface and powerful real-time replication capabilities. Harness the power of both platforms to create a robust data ecosystem that drives business intelligence, analytics, and data-driven decision-making.
Key Takeaways:
1. Effortless Migration: Learn how to migrate your PostgreSQL data to Snowflake in 8 simple steps, even with limited technical expertise.
2. Real-Time Insights: Achieve near-instantaneous data syncing for up-to-the-minute analytics and reporting.
3. Cost-Effective Solution: Lower your total cost of ownership (TCO) with Estuary Flow's efficient and scalable architecture.
4. Seamless Integration: Combine the strengths of PostgreSQL's transactional power with Snowflake's cloud-native scalability and data warehousing features.
Don't miss out on this opportunity to unlock the full potential of your data. Read & Download this comprehensive guide now and embark on a seamless data journey from PostgreSQL to Snowflake with Estuary Flow!
Try it Free: https://dashboard.estuary.dev/register
Ansys Mechanical enables you to solve complex structural engineering problems and make better, faster design decisions. With the finite element analysis (FEA) solvers available in the suite, you can customize and automate solutions for your structural mechanics problems and parameterize them to analyze multiple design scenarios. Ansys Mechanical is a dynamic tool that has a complete range of analysis tools.
An MVP (Minimum Viable Product) mobile application is a streamlined version of a mobile app that includes only the core features necessary to address the primary needs of its users. The purpose of an MVP is to validate the app concept with minimal resources, gather user feedback, and identify any areas for improvement before investing in a full-scale development. This approach allows businesses to quickly launch their app, test its market viability, and make data-driven decisions for future enhancements, ensuring a higher likelihood of success and user satisfaction.
Attendance Tracking From Paper To DigitalTask Tracker
If you are having trouble deciding which time tracker tool is best for you, try "Task Tracker" app. It has numerous features, including the ability to check daily attendance sheet, and other that make team management easier.
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...onemonitarsoftware
Unlock the full potential of mobile monitoring with ONEMONITAR. Our advanced and discreet app offers a comprehensive suite of features, including hidden call recording, real-time GPS tracking, message monitoring, and much more.
Perfect for parents, employers, and anyone needing a reliable solution, ONEMONITAR ensures you stay informed and in control. Explore the key features of ONEMONITAR and see why it’s the trusted choice for Android device monitoring.
Share this infographic to spread the word about the ultimate mobile spy app!
A captivating AI chatbot PowerPoint presentation is made with a striking backdrop in order to attract a wider audience. Select this template featuring several AI chatbot visuals to boost audience engagement and spontaneity. With the aid of this multi-colored template, you may make a compelling presentation and get extra bonuses. To easily elucidate your ideas, choose a typeface with vibrant colors. You can include your data regarding utilizing the chatbot methodology to the remaining half of the template.
React and Next.js are complementary tools in web development. React, a JavaScript library, specializes in building user interfaces with its component-based architecture and efficient state management. Next.js extends React by providing server-side rendering, routing, and other utilities, making it ideal for building SEO-friendly, high-performance web applications.
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...Hironori Washizaki
Hironori Washizaki, "Charting a Course for Equity: Strategies for Overcoming Challenges and Promoting Inclusion in the Metaverse", IEEE COMPSAC 2024 D&I Panel, 2024.
WhatsApp Tracker - Tracking WhatsApp to Boost Online Safety.pdfonemonitarsoftware
WhatsApp Tracker Software is an effective tool for remotely tracking the target’s WhatsApp activities. It allows users to monitor their loved one’s online behavior to ensure appropriate interactions for responsive device use.
Download this PPTX file and share this information to others.
Google ML-Kit - Understanding on-device machine learning
Introduction to Game Programming: Using C# and Unity 3D - Chapter 7 (Preview)
1. Vahé Karamian
207
Chapter 7 – Delving Into the Code
If you have following along in Chapter 3 – Game Objects and Compo-
nents and Chapter 6 – Creating Battleship, you should have a good
understanding of the concepts and a clear idea of our game objective.
To do a quick recap, in Chapter 3, we covered the basics of Game Ob-
jects and Unity IDE, the key concept of the chapter was to get you
started in the right direction, and allow you to jump start your own
study and development of the IDE.
Chapter 6 was fully dedicated to the concept and the idea of the
game called Battle Ship. We covered a lot of important ideas, ap-
proaches in general to software development, and we used Battle Board
as an example for demonstration. In this chapter, we are going to delve
into the code behind the game and see how it drives everything and
glues everything together.
Script – BoardUIVer1.cs
Board UI Ver 1 script is used to control the individual board units of
the given board within the game. If you recall from our earlier discus-
sion regarding the approach we should take for the design and
implementation of our game board, you will recall that we have a spe-
cific prefab dedicated for the visual representation of our board unit.
The details of the prefab are discussed in the following section, Putting
Everything Together - Game Objects, in Chapter 6 – Creating Battle-
ship.
The prefab on its own is pretty useless. In order for us to be able
to bring it to life and interact with the prefab we need some kind of
scripting. The script is used to interact and modify the state of a given
GameObject. In this particular case, this happens to be our Board Unit.
Let’s take a look at the code listing, and go over each section and
break down the logic and understand what it is trying to achieve.
2. Unity 3D – Game Programming Intro
208
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class BoardUIVer1 : MonoBehaviour {
public GameObject AttackPrefab;
public GameObject WreckPrefab;
public GameObject AttackPosition;
public GameObject CubePrefab;
float timeLimit = 4.0f; // 10 seconds.
public Text lblBoardPosition;
public int ROW;
public int COL;
public bool OCCUPIED; // used to indicate if unit is occupied
public bool ATTACKED; // used to indicate if unit is attacked
// Use this for initialization
void Start () {
this.OCCUPIED = false;
this.ATTACKED = false;
}
private GameObject tmp = null;
private GameObject tmp1 = null;
private GameObject tmp2 = null;
// Update is called once per frame
void Update () {
if(transform.tag.Equals("boardAttack") && this.ATTACKED &&
this.OCCUPIED)
{
this.WreckPrefab.SetActive(true);
if (timeLimit > 0)
{
// Decrease timeLimit.
timeLimit -= Time.deltaTime;
if(this.tmp==null)
tmp = GameObject.Instantiate(this.AttackPrefab,
this.AttackPosition.trans-
form.position,
this.AttackPosition.trans-
form.rotation) as GameObject;
//Destroy(tmp, 3.0f);
}
else
3. Vahé Karamian
209
{
Destroy(tmp);
timeLimit = 4.0f;
}
}
if (transform.tag.Equals("board") && this.ATTACKED && this.OCCUPIED)
{
this.CubePrefab.SetActive(false);
if (timeLimit > 0)
{
// Decrease timeLimit.
timeLimit -= Time.deltaTime;
if (this.tmp2 == null)
tmp2 = GameObject.Instantiate(this.AttackPrefab,
new Vector3(transform.position.x, 1.0f, transform.position.z),
transform.rotation) as GameObject;
}
else
{
Destroy(tmp2);
timeLimit = 4.0f;
}
}
}
public void PlaceEnableCubePrefab()
{
this.CubePrefab.SetActive(true);
}
}
Code Block 47 - Listing for BoardUIVer1.cs
Let’s start by stating that BoardUIVer1 is defined as a class that is
inheriting from MonoBehaviour21
. All C# scripts by default inherit
from MonoBeviour. By default each script has a Start() and an Up-
date() function defined.
The Start() function will be called by Unity before gameplay be-
gins, i.e. before the Update() function is called for the first time, and it
is the ideal place to do your initialization.
21
MonoBehaviour is the base class every script derives from.
4. Vahé Karamian
211
Start(), in the Start() function the two variable OCCUPIED
and ATTACKED are initialized to false. This is because by
default none of the board units are occupied or attacked.
Update(), the Update() function is a little more involved. It
is used to manage the visual aspect of the board unit based
on the state.
PlaceEnableCubePrefab(), this function is used to enable
the prefab defined in the board unit.
Let’s look at the Update() function in more depth. This is where
most of the action is happening for this particular class. There are two
main conditions that we are checking:
if(transform.tag.Equals("boardAttack") && this.ATTACKED && this.OCCUPIED)
{
this.WreckPrefab.SetActive(true);
if (timeLimit > 0)
{
// Decrease timeLimit.
timeLimit -= Time.deltaTime;
if(this.tmp==null)
tmp = GameObject.Instantiate(this.AttackPrefab,
this.AttackPosition.transform.position,
this.AttackPosition.transform.rotation) as GameObject;
}
else
{
Destroy(tmp);
timeLimit = 4.0f;
}
}
// This code block here is used for the enemny player placeholder ...
if (transform.tag.Equals("board") && this.ATTACKED && this.OCCUPIED)
{
this.CubePrefab.SetActive(false);
if (timeLimit > 0)
{
// Decrease timeLimit.
timeLimit -= Time.deltaTime;
if (this.tmp2 == null)
tmp2 = GameObject.Instantiate(this.AttackPrefab,
new Vector3(transform.position.x, 1.0f, transform.position.z),
transform.rotation) as GameObject;
}
else
{
Destroy(tmp2);
5. Vahé Karamian
213
. …
. …
public Camera cameraEndGame;
public AudioClip explosionPlayerBlast;
public AudioClip explosionEnemyBlast;
private AudioSource audioSource;
public GameObject BoardUnitPrefab;
public GameObject BoardUnitAttackPrefab;
public GameObject CubePrefab;
// this variable will be used for chapter 5 ... enhancements of the code
public GameObject IverHuitfeldt;
public GameObject IverHuitfeldtAnchorPosition;
public GameObject AdmiralSergeyGorshkov;
public GameObject AdmiralSergeyGorshkovAnchorPosition;
public GameObject MRVikhrIFQ;
public GameObject MRVikhrIFQAnchorPosition;
public GameObject Steregushchiy;
public GameObject SteregushchiyAnchorPosition;
public GameObject AdmiralKuznetsov;
public GameObject AdmiralKuznetsovAnchorPosition;
// ----------------------------------------------------------------------
public GameObject[,] boardPlayer = new GameObject[10,10];
public GameObject[,] boardEnemy = new GameObject[10, 10];
// used for placing enemy ships (by size)
private int[] ships = new int[5] {2,3,3,4,5};
private int maxNumberOfHits = 17;
private int playerHitCount = 0;
private int enemyHitCount = 0;
public int blockSize = 3;
public bool vertical = false;
public GameObject myWater;
#region BUTTON REF
public Button butAircraftCarrier;
public Button butBattleship;
public Button butSubmarine;
public Button butDestroyer;
public Button butPatrolBoat;
public Button butUIReset;
public Button butExit;
6. Vahé Karamian
215
maxNumberOfHits, is of type int, and is used to represent
the maximum value attainable for a win.
playerHitCount, is of type int, it is the counter for the
player’s score.
enemyHitCount, is of type int, it is the counter for the A.I.’s
score.
blockSize, is of type int, it is used for measuring and com-
puting the boundary of ship placement on the game boards.
Think of it as a margin or a padding measurement.
vertical, is of type bool, it is used to identify if the current
piece to be placed is going to be vertical or horizontal.
As you can see, the list of variables to manage the game is pretty
extensive. We will see how each one is being used when we cover the
functions in the class.
Advanced Graphic Variables
The following variables are all of type GameObject. They are a
reference to the prefabs that represent the 3D model for each ship that
will be placed on the player’s board.
IverHuitfeldt
IverHuitfeldtAnchorPosition
AdmiralSergeyGorshkov
AdmiralSergeyGorshkovAnchorPosition
MRVikhrIFQ
MRVikhrIFQAnchorPosition
Steregushchiy
SteregushchiyAnchorPosition
AdmiralKuznetsov
AdmiralKuznetsovAnchorPosition
Graphical User Interface Variables
The following variables are used to reference the UI elements in
the game. The variables starting with butXXX are representing the but-
tons defined in the UI that the user can interact with. The variables
7. Vahé Karamian
217
CheckPlayerBoard(), is responsible for handing the place-
ment of the game pieces onto the player’s game board.
CheckAttackBoard(), is responsible for handling the attack
and detection of a hit for both the player and the enemy.
Wait4Me(), is a function used for time delay.
Update(), is a function that is called every frame. The Up-
date() function is the main body of the game program. It
determines the state of the game and calls the appropriate
functions as needed during the lifetime of the game.
ChangeHitDirection(), this function is used by the A.I. to
make a decision about the direction its next move will be.
PlaceEnemyShips(), this function is used by the A.I. to de-
cide where it wants to place its ships on the game board
before the game starts.
CheckBoardForEnemyPlacement(row,col,size,hor), this
function is used by the A.I. to determine if the placement
of the ship is valid or not. It is a recursive function. It is
based on the original row and column data the size of the
ship and the orientation.
CheckWhichShipWasPlaced(row,col), this function is used
by the A.I. to determine which ship is has placed onto the
game board.
butCreateBattleship(size), this function is triggered when
the player selects the UI button defined for a specific ship
for placement.
butCreateBattleShipSetID(shipID), this function is trig-
gered when the player selects the UI button defined for a
specific ship for placement. The two function together pro-
vide the size and the ID of the selected ship.
butRestart(), this functions does some cleanup work and
restarts the game.
butExitClick(), this functions terminates the game.
butChangeOrientation(), this function changes the orienta-
tion of the player’s piece placement onto the game board.
ResetGUIButtons(), this function resets all of the GUI but-
tons when the user restarts the game.
8. Vahé Karamian
219
this.enemyHitCount = 0;
this.hit_row = -1;
this.hit_col = -1;
this.hit_dir = HitDirection.none;
this.IsBusy = false;
this.gotoLastHit = false;
this.imgYouLose.enabled = false;
this.imgYouWin.enabled = false;
this.butUIReset.gameObject.SetActive(false);
#if UNITY_WEBPLAYER
// for web player we do not need to display the exit button!!!
this.butExit.gameObject.SetActive(false);
this.butUIReset.GetComponent<RectTransform>().Translate(new Vector3(75,
0, 0));
#endif
if(this.vertical)
{
this.butVertical.gameObject.SetActive(true);
this.butHorizontal.gameObject.SetActive(false);
}
else
{
this.butVertical.gameObject.SetActive(false);
this.butHorizontal.gameObject.SetActive(true);
}
#endregion
// clear the board(s)
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
boardPlayer[i, j] = null;
boardEnemy[i, j] = null;
}
}
// create a 10x10 board - Board 1
int row = 1;
int col = 1;
for(int i=0; i<10; i++)
{
for(int j=0; j<10; j++)
{
// instantiate prefab and place it properly on the scene
GameObject tmp = GameObject.Instantiate(this.BoardUnitPrefab,
new Vector3(i, 0, j), this.BoardUnitPrefab.transform.rota-
tion) as GameObject;
BoardUIVer1 tmpUI = tmp.GetComponent<BoardUIVer1>();
9. Vahé Karamian
221
The next two lines of code disables the end game camera we have
setup through the variable cameraEndGame. We also disable the can-
vas object that is referencing the score board through the
canvasScoreBoard variable. The next few lines initialize all of the var-
iables that are used for handing the game data.
Going to the first for loop, we are initializing the game boards for
both the player and the enemy. Here we have two for loops, one em-
bedded in the other representing the rows and the columns of our
boards. They are set to iterate 10 times each, as that is the size of our
board. Notice that we are nullifying each position in the matrix/board,
hence preparing it for the actual creation of the board in the next step.
// create a 10x10 board - Board 1
int row = 1;
int col = 1;
for(int i=0; i<10; i++)
{
for(int j=0; j<10; j++)
{
// instantiate prefab and place it properly on the scene
GameObject tmp = GameObject.Instantiate(this.BoardUnitPrefab,
new Vector3(i, 0, j), this.BoardUnitPrefab.transform.rotation) as
GameObject;
BoardUIVer1 tmpUI = tmp.GetComponent<BoardUIVer1>();
string name = string.Format("B1:[{0:00},{1:00}]", row, col);
tmpUI.lblBoardPosition.text = name;
tmpUI.COL = j;
tmpUI.ROW = i;
boardPlayer[i, j] = tmp;
tmp.name = name;
col++;
}
col = 1;
row++;
}
Code Block 51 - Code for Construction of Player's Board
All this code is doing is instantiating our prefab referenced by the
variable BoardUnitPrefab, it is located a position <i,0,j> where i is
the row, and j is the column, and the Vector3 object is the 3D position
of the Board Unit in 3D space. The rotation is set to the default of the
transform of the object.
10. Vahé Karamian
223
The biggest difference you will notice here is the starting point for
the variable i. This is because we need to displace the actual creation
of the GameObject at a specific coordinate. This is specifically used
only for the placement of the object in the 3D world.
If you notice, we use the row and col variables for the actual data
assignment for the Board Unit, and not the, i and j variables as before.
This is because, the row and col represent the numbers we want inter-
nally for the unit board and also the storing of the GameObject in the
2-dimensionsl array representing the Enemy’s game board. Other than
that, everything else is the same logic.
Update() Function Implementation
The next function we should look at is the Update() function. This
function is the heart of the script. It gets called every single frame by
the Unity Game Engine. It also controls the flow of the game.
// Update is called once per frame
void Update ()
{
if (this.IsBusy)
return;
if (this.count < 5)
{
// If the up arrow or the right mouse button has been clicked, then
switch between
// vertical and horizontal
if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetMouseButtonUp(1))
this.vertical = !this.vertical;
if (this.vertical)
{
this.butVertical.gameObject.SetActive(true);
this.butHorizontal.gameObject.SetActive(false);
}
else
{
this.butVertical.gameObject.SetActive(false);
this.butHorizontal.gameObject.SetActive(true);
}
this.CheckPlayerBoard();
}
else
{
if (placeEnemyShips)
11. Vahé Karamian
225
if (tmp.GetComponent<BoardUIVer1>().OCCUPIED && !tmp.Get-
Component<BoardUIVer1>().ATTACKED)
{
tmp.transform.GetComponent<Renderer>().material.color =
Color.cyan;
}
}
}
}
// change the water rendering mode
Water tmpWater = this.myWater.gameObject.GetComponent<Water>();
tmpWater.waterMode = Water.WaterMode.Reflective;
this.cameraEndGame.gameObject.SetActive(true);
}
}
}
Code Block 53 - Update() function defined in BoardVer1 class
The Update() function is somewhat complex, but it is manageable.
The first if condition checks to see if the thread is busy based on a
Boolean variable named IsBusy, and if so, it exits the function until the
next cycle. This variable is updated by the A.I.’s ship placement pro-
cess.
The next condition block if (this.count < 5) handles the Player’s
ship placement. The count variable is used to keep track of the place-
ment of the player’s pieces. So starting at 0, it increments each time
there is a successful placement of a game piece onto the board. Within
the if block, the code check for mouse input from the user to see if the
right-button on the mouse or the up arrow key has been pressed, if ei-
ther one of this conditions is true, then the orientation of the piece
placement will be inversed. This is done using the this.vertical vari-
able.
The next set of if blocks are used for updating the GUI interface
based on the user input for the orientation button. Finally, the code calls
the this.CheckPlayerBoard(); function which then takes care of the ac-
tual placement of the game piece. This function will be covered
separately.
In the else section of the if condition, we determine if the A.I.
needs to start placing its game pieces or the game is ready to start.
12. Vahé Karamian
227
{
if (boardData.OCCUPIED)
tmpHighlight.GetComponent<Renderer>().material.color =
Color.red;
else
tmpHighlight.GetComponent<Renderer>().material.color =
Color.white;
}
if (this.tmpBlockHolder != null)
{
Destroy(this.tmpBlockHolder);
}
if (this.PLACE_BLOCK)
{
this.tmpBlockHolder = new GameObject();
this.OK_TO_PLACE = true;
if (!this.vertical && (tmpUI.ROW <= 10 - this.blockSize))
{
for (int i = 0; i < this.blockSize; i++)
{
GameObject visual = GameObject.Instantiate(this.CubeP-
refab, new Vector3(tmpUI.ROW + i, this.CubePrefab.transform.position.y,
tmpUI.COL), this.CubePrefab.transform.rotation) as GameObject;
GameObject bp = boardPlayer[tmpUI.ROW + i, tmpUI.COL];
BoardUIVer1 bpUI = bp.GetComponent<BoardUIVer1>();
if (!bpUI.OCCUPIED)
{
visual.GetComponent<Renderer>().material.color =
Color.gray; // ok to place
}
else
{
visual.transform.localScale = new Vector3(0.6f,
0.6f, 0.6f);
visual.GetComponent<Renderer>().material.color =
Color.yellow; // not ok
this.OK_TO_PLACE = false;
}
visual.transform.parent = this.tmpBlockHolder.trans-
form;
}
}
if (this.vertical && (tmpUI.COL <= 10 - this.blockSize))
{
for (int i = 0; i < this.blockSize; i++)
{
GameObject visual = GameObject.Instantiate(this.CubeP-
refab, new Vector3(tmpUI.ROW, this.CubePrefab.transform.position.y,
tmpUI.COL + i), this.CubePrefab.transform.rotation) as GameObject;
GameObject bp = boardPlayer[tmpUI.ROW, tmpUI.COL + i];
13. Unity 3D – Game Programming Intro
230
Mathematical Definition of a Ray: A portion of a line which starts at a point
and goes off in a particular direction to infinity.
A ray is used in Unity, in conjunction with the Raycast() function
defined in the Physics object, to generate a logical line in the 3D space
and when you shoot the ray, it actually will provide information regard-
ing any object in its path. It is basically used for Ray Casting23
.
This particular satetement if (Physics.Raycast(ray, out tmpHi-
tHighlight, 100)), is what makes our Raycast work and also returns
the necessary data needed. The hit data is stored in tmpHighligh varia-
ble. Before continuing, we should also list some temporary variables
that are used specifically within the CheckPlayerBoard() function.
GameObject tmpHighlight = null;
RaycastHit tmpHitHighlight;
GameObject tmpBlockHolder = null;
private bool OK_TO_PLACE = true;
Code Block 55 - Temporary variables used by CheckPlayerBoard()
NOTE: The variables listed in Code Block 55 are all also part of the class
data, however, they have been listed right above the CheckPlayerBoard() function
for clarification.
Due to the nature of the scene setup we know that the only objects
that can be hit by the Raycast are going to be the Unit Boards and also
the other game pieces. What we would like to do is extract the
BoardUIVer1 component from the tmpHitHighlight variable, and start
processing the object.
There is two conditions we are looking for, first, we want to make
sure that the raycast hit registered a board unit. This is done with the
identification of the tag. The second condition is to make sure that the
given board unit is not occupied. If these two conditions are met, we
23
Ray casting is the use of ray-surface intersection tests to solve a variety of problems in
computer graphics and computational geometry. The term was first used in computer graphics
in a 1982 paper by Scott Roth to describe a method for rendering constructive solid geometry
models.
14. Unity 3D – Game Programming Intro
232
visual.transform.localScale = new Vector3(0.6f,
0.6f, 0.6f);
visual.GetComponent<Renderer>().material.color =
Color.yellow; // not ok
this.OK_TO_PLACE = false;
}
visual.transform.parent = this.tmpBlockHolder.trans-
form;
}
}
if (this.vertical && (tmpUI.COL <= 10 - this.blockSize))
{
for (int i = 0; i < this.blockSize; i++)
{
GameObject visual = GameObject.Instantiate(this.CubeP-
refab, new Vector3(tmpUI.ROW, this.CubePrefab.transform.position.y,
tmpUI.COL + i), this.CubePrefab.transform.rotation) as GameObject;
GameObject bp = boardPlayer[tmpUI.ROW, tmpUI.COL + i];
BoardUIVer1 bpUI = bp.GetComponent<BoardUIVer1>();
if (!bpUI.OCCUPIED)
{
visual.GetComponent<Renderer>().material.color =
Color.gray; // ok to place
}
else
{
visual.transform.localScale = new Vector3(0.6f,
0.6f, 0.6f);
visual.GetComponent<Renderer>().material.color =
Color.yellow; // not ok
this.OK_TO_PLACE = false;
}
visual.transform.parent = this.tmpBlockHolder.trans-
form;
}
}
}
tmpHitHighlight.transform.GetComponent<Renderer>().mate-
rial.color = Color.blue;
tmpHighlight = tmpHitHighlight.transform.gameObject;
}
}
}
Code Block 56 - Determining what object we have hit by ray casting.
15. Unity 3D – Game Programming Intro
234
this.AdmiralKuznetsov.transform.position.y, col), this.AdmiralKuz-
netsov.transform.rotation) as GameObject;
testingVisual.transform.RotateAround(testingVisual.transform.po-
sition, Vector3.up, 90.0f);
}
else
{
GameObject testingVisual = GameObject.Instantiate(this.Admi-
ralKuznetsov, new Vector3(row, this.AdmiralKuznetsov.transform.position.y,
col + 2), this.AdmiralKuznetsov.transform.rotation) as GameObject;
}
// Aircraft Carrier was placed, disable button
this.butAircraftCarrier.gameObject.SetActive(false);
this.count++;
break;
}
case 2:
{
if (!this.vertical)
{
// place it as vertical
GameObject testingVisual = GameObject.Instantiate(this.Stere-
gushchiy, new Vector3(row + 1.5f, this.Steregushchiy.transform.position.y,
col), this.Steregushchiy.transform.rotation) as GameObject;
testingVisual.transform.RotateAround(testingVisual.transform.po-
sition, Vector3.up, 90.0f);
}
else
{
GameObject testingVisual = GameObject.Instantiate(this.Stere-
gushchiy, new Vector3(row, this.Steregushchiy.transform.position.y,
col + 1.5f), this.Steregushchiy.transform.rotation) as GameObject;
}
// Battle ship was placed, disable button
this.butBattleship.gameObject.SetActive(false);
this.count++;
break;
}
case 3:
{
if (!this.vertical)
{
// place it as vertical
GameObject testingVisual = GameObject.Instantiate(this.Admiral-
SergeyGorshkov, new Vector3(row + 1,
this.AdmiralSergeyGorshkov.transform.position.y, col),
this.AdmiralSergeyGorshkov.transform.rotation) as GameObject;
testingVisual.transform.RotateAround(testingVisual.transform.po-
sition, Vector3.up, 90.0f);
}
16. Unity 3D – Game Programming Intro
236
this.MRVikhrIFQ.transform.position.y, col + 0.5f), this.MRVikhrIFQ.trans-
form.rotation) as GameObject;
}
// Patrol Boat was placed, disable the button
this.butPatrolBoat.gameObject.SetActive(false);
this.count++;
break;
}
}
// clear internal data
this.currentShipID = 0;
this.blockSize = 0;
}
Code Block 57 - Visually placing the selected piece onto the game board
The main logic in the code here is to identify the ID of the ship and
properly instantiate the associated prefab onto the game board.
PlaceEnemyShips() Function Implementation
Once all of the player’s game pieces have been placed onto the
board, the A.I. needs to do the same. The PlaceEnemyShips() function
is used to place the pieces for the computer opponent.
private void PlaceEnemyShips()
{
this.placeEnemyShips = false;
for(int i=0; i<this.ships.Length; i++)
{
int row = Random.Range(0,9);
int col = Random.Range(0,9);
bool ori = (Random.Range(0, 9) > 5) ? true : false;
this.CheckBoardForEnemyPlacement(row, col, this.ships[i], ori);
}
}
Code Block 58 - Function for A.I. to place game pieces
The function uses a for loop to iterate through all of the game
pieces that need to be placed onto the A.I. game board. Within the for
loop, the logic generates a random row and a random column position
and a random orientation for the current piece that is being prepared for
placement.
17. Unity 3D – Game Programming Intro
238
}
if (okToPlace)
{
if (!hor)
{
for (int i = 0; i < size; i++)
{
GameObject visual = GameObject.Instantiate(this.CubePrefab,
new Vector3(row + i, 11.9f, col),
this.CubePrefab.transform.rotation) as GameObject;
visual.GetComponent<Renderer>().material.color = Color.yellow;
visual.tag = "enemyPrefabPH";
GameObject sB = boardEnemy[row + i, col];
sB.GetComponent<BoardUIVer1>().OCCUPIED = true;
boardEnemy[row + i, col] = sB;
visual.gameObject.name = string.Format("EN-R-[{0},{1}]", row +
i, col);
}
}
if (hor)
{
for (int i = 0; i < size; i++)
{
GameObject visual = GameObject.Instantiate(this.CubePrefab,
new Vector3(row, 11.9f, col + i),
this.CubePrefab.transform.rotation) as GameObject;
visual.GetComponent<Renderer>().material.color = Color.magenta;
GameObject sB = boardEnemy[row, col + i];
sB.GetComponent<BoardUIVer1>().OCCUPIED = true;
boardEnemy[row, col + i] = sB;
visual.gameObject.name = string.Format("EN-C-[{0},{1}]", row,
col+i);
}
}
}
else
{
int r1 = Random.Range(0, 9);
int c1 = Random.Range(0, 9);
this.CheckBoardForEnemyPlacement(r1, c1, size, hor);
}
}
Code Block 59 - Function responsible for A.I. game piece placement
18. Unity 3D – Game Programming Intro
240
if (tmpAttackHighlight != null)
{
if (bpUI.ATTACKED)
{
if (bpUI.ATTACKED)
{
tmpAttackHighlight.GetComponent<Renderer>().mate-
rial.color = Color.gray;
}
}
else
{
tmpAttackHighlight.GetComponent<Renderer>().mate-
rial.color = Color.white;
}
}
tmpAttackHitHighlight.transform.GetComponent<Renderer>().ma-
terial.color = Color.blue;
tmpAttackHighlight = tmpAttackHitHighlight.transform.gameOb-
ject;
}
}
}
if (Input.GetMouseButton(0))
{
Ray ray1 = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray1, out hit, 200))
{
Debug.Log(hit.transform.gameObject.name);
if (hit.transform.tag.Equals("boardAttack"))
{
BoardUIVer1 tmpUI = hit.transform.GetCompo-
nent<BoardUIVer1>();
GameObject enemyBoard = boardEnemy[tmpUI.ROW, tmpUI.COL];
Debug.Log(string.Format("Enemy Board: {0}", enemyBoard.trans-
form.name));
// check to see if we have a hit on the player board
// we need to make sure that we don't increase just because
we are hitting the board
if (enemyBoard.GetComponent<BoardUIVer1>().OCCUPIED && !ene-
myBoard.GetComponent<BoardUIVer1>().ATTACKED)
{
// we have a hit
enemyBoard.transform.GetComponent<BoardUIVer1>().OCCUPIED
= true;
enemyBoard.transform.GetComponent<BoardUIVer1>().ATTACKED
= true;
19. Unity 3D – Game Programming Intro
242
{
// make sure to check the bounds ...
case HitDirection.up:
{
r1 = this.hit_row + 1;
c1 = this.hit_col;
break;
}
case HitDirection.right:
{
c1 = this.hit_col + 1;
r1 = this.hit_row;
break;
}
case HitDirection.down:
{
r1 = this.hit_row - 1;
c1 = this.hit_col;
break;
}
case HitDirection.left:
{
c1 = this.hit_col - 1;
r1 = this.hit_row;
break;
}
default:
{
r1 = Random.Range(0, 9);
c1 = Random.Range(0, 9);
break;
}
}
if((r1<0 || r1>9) || (c1<0 || c1 > 9))
{
// we aldo need to check and change hit_direction in here ...
this.ChangeHitDirection();
this.CheckAttackBoard(); // try a new unit
return; // exit after the call back
}
Debug.Log(string.Format("R1={0}, C1={1}", r1, c1));
GameObject playerBoard = boardPlayer[r1, c1];
// check to see if the unit has been attacked before, if it has been
then try a new location
if(playerBoard.GetComponent<BoardUIVer1>().ATTACKED)
{
// we aldo need to check and change hit_direction in here ...
this.ChangeHitDirection();
20. Unity 3D – Game Programming Intro
244
point. As before, the function is dependent on some more variables for
accounting and etc… The following is a list of the variables used within
the function:
GameObject tmpAttackHighlight = null;
RaycastHit tmpAttackHitHighlight;
GameObject tmpAttackBlockHolder = null;
#region A.I. Memory for Hit success
public enum HitDirection { none, up, right, down, left };
public int hit_row; // used for current hit row
public int hit_col; // used for current hit col
public HitDirection hit_dir; // used for current hit dir
public int hit_row_last; // used for last known hit row
public int hit_col_last; // used for last known hit col
public HitDirection hit_dir_last; // used for last known hit dir
public bool playerHadHit = false;
public bool gotoLastHit = false;
#endregion
Code Block 61 - Variables used by CheckAttackBoard() function
The variables listed in Code Block 61 are specifically used by the
CheckAttackBoard() function. As stated previously, they have been de-
fined before the function for clarity.
One big difference that should catch your eye, while you review
the code, is the variables defined for the A.I. operations. The A.I. needs
to represent the current hit selection, and it also needs to keep track of
its previous move so that it can determine what location and direction
to move next. The variables defined in Code Block 61 help with these
operations.
The first if block checks to see who’s turn it is for the attack. As-
suming that it is the player’s turn, the program once again uses the ray
cast operation to grab the board unit that has been returned through the
tmpAttackHighlight variable. The logic here is almost the same as that
defined in the CheckPlayerBoard() function. But notice that our condi-
tions are different. We are checking to make sure we are selecting the
enemy’s board for the attack movement, and that the selected board
unit has not been attacked before.
21. Unity 3D – Game Programming Intro
246
In Code Block 62, we have isolated the code responsible for the
registration of a hit or a miss by the player. If we have a hit, we update
the state of the unit board accordingly on the display as well as the data
that represents the board in the 2-dimensional array. Likewise we do
the same if the attack is a miss.
There is one last condition we need to check, if the player has a hit,
then it will be again the player’s turn to select the next attack position.
Otherwise, we give the turn to the A.I.
if(Input.GetMouseButtonUp(0))
{
if (!this.playerHadHit)
{
// now we will capture the true aspect for turn of player vs. A.I.
this.PLAYER_TURN = !this.PLAYER_TURN;
this.playerHadHit = false;
}
}
Code Block 63 - Changing Turns after Player's selection
Looking at the scenario where it is the A.I.’s turn to attack, the A.I.
checks to see if it had a hit from the previous move, and if so, it gets
the hit direction, the hit row and the hit column. Based on the infor-
mation provided, it decides where to make its next move. After the
move we check to make sure we are in the boundaries of the board. If
not, we recursively call the function to get a new attack position.
If all is well, we grab the player’s unit board data, and check to see
if it was previously attacked, if so we get a new position.
Finally, we check to see if the position selected is occupied, this
determines if we have a hit for the move. The program performs the
necessary accounting, saves the updated data into the 2-dimensional
array representing the player’s board and the process goes to the next
step.
22. Unity 3D – Game Programming Intro
248
Game User Interface
The following variables are used to reference the UI elements in
the game. The variables starting with butXXX are representing the but-
tons defined in the UI that the user can interact with. The variables
starting with lblXXX are referencing labels in the UI, the variables start-
ing with imgXXX are referencing images in the UI. The variable
canvasScoreBoard is of type Canvas and is used to reference the score
board in the game. We will also look at these in more detail in the next
section.
butAircraftCarrier
butBattleship
butSubmarine
butDestroyer
butPatrolBoat
butUIReset
butExit
butHorizontal
butVertical
canvasScoreBoard
lblPlayerScore
lblAIScore
imgYouWin
imgYouLose
The following figures will illustrate the UI concepts:
Figure 81 - User Interface - Player game piece placement
In Figure 81 you will notice the position of the primary buttons
presented to the player at the start of the game. The players is shows
five buttons for each game piece that needs to be placed onto the game
23. Vahé Karamian
249
board. Once the player selects a particular ship, the UI will trigger the
necessary functions that provide the size of the game piece as well as
the ID associated with it. The details of this is covered in the following
sections.
The button on the top left corner of the screen is used for the ori-
entation of the ship that is going to be places on the board, and the
button on the top right corner is the exit button. This is only visible on
non-web deployments. In other words, you need a way to exit the ap-
plication on a computer or a mobile device, this button will take care
of that for you!
Figure 82 - User Interface Game Play
Figure 82 the player places all the game pieces, the User Interface
of the game changes to reflect appropriately. All UI elements associ-
ated with placements of game pieces are replaced with the UI elements
associated with the score board and the ability to restart the game and
or exit the game. This is illustrated in Figure 82. In the next section we
will discuss the details of the functions and the design time elements of
the GUI.
Button Events for Placing Game Pieces
There are two supporting function that are used at the beginning of
the game to allow the player for placing his/her game pieces. These two
function are:
24. Unity 3D – Game Programming Intro
252
Button Event for Restart
The restart button is used to clean out the game and reset all of the
variables to their default values. This gives the player the ability to reset
the game at any time during the game play. Here is the code listing for
the reset function.
public void butRestart()
{
GameObject[] playerBoardGO = GameObject.FindGameObjectsWithTag("board");
foreach(var go in playerBoardGO)
{
Destroy(go);
}
GameObject[] enemyBoardGO = GameObject.FindGameOb-
jectsWithTag("boardAttack");
foreach(var go in enemyBoardGO)
{
Destroy(go);
}
GameObject[] enemyPrefabPH = GameObject.FindGameObjectsWithTag("ene-
myPrefabPH");
foreach(var go in enemyPrefabPH)
{
Destroy(go);
}
GameObject[] shipModels = GameObject.FindGameObjectsWithTag("shipModel");
foreach (var go in shipModels)
{
Destroy(go);
}
this.ResetGUIButtons();
Start();
}
Code Block 66 - Reset function listing
In this function, you will notice that the first for loop is iterating
through the player’s board units and destroying them one by one. This
process happens for all of the other Game Objects present in the 3D
world. Once the Game Objects have been destroyed, the ResetGUIBut-
tons() function is called to reset the GUI elements.
private void ResetGUIButtons()
{
this.butAircraftCarrier.gameObject.SetActive(true);
26. Vahé Karamian
255
Appendix 1 – Table of Figures
Table of Figures
Figure 1 - for loop diagram.............................................................................................9
Figure 2 - foreach loop diagram ...................................................................................10
Figure 3 - while loop diagram.......................................................................................11
Figure 4 - do-while loop diagram .................................................................................11
Figure 5-Car Object......................................................................................................18
Figure 6-Airplane Composite Object............................................................................23
Figure 7-Inheritance Example ......................................................................................25
Figure 8-Unity 5 Editor ................................................................................................35
Figure 9-Cube Primitive ...............................................................................................38
Figure 10-Inspector Window........................................................................................40
Figure 11-Transform Tools...........................................................................................41
Figure 12-Position ........................................................................................................41
Figure 13-Rotation........................................................................................................41
Figure 14-Scale.............................................................................................................41
Figure 15-New Material names CH1EX1MAT............................................................42
Figure 16-Applying the CH1EX1MAT material to the Cube GameObject ..................44
Figure 17-Cube2 Position, Rotation, Scale...................................................................46
Figure 18-Script Attached to Game Object...................................................................49
Figure 19 - Property Types, Reference and Value........................................................53
Figure 20 - Car Class Properties...................................................................................54
Figure 21 - NavMesh Components...............................................................................57
Figure 22 - Prefab Concept...........................................................................................59
Figure 23 - Simple 50x50 Terrain.................................................................................67
Figure 24 - Snap shot of Terrain Tool ..........................................................................68
Figure 25 - Terrain Design ...........................................................................................68
Figure 26 - Terrain with texture applied .......................................................................69
Figure 27 - Search and collect game objects.................................................................70
Figure 28 - Cube Prefab with Cube Collider ................................................................75
Figure 29 - Inspector Window showing Box Collider ..................................................76
Figure 30 - Rigidbody Freeze Rotation ........................................................................79
Figure 31 - Third Person Camera Setup........................................................................80
Figure 32 - Collider Interaction after IsTrigger is Enabled...........................................81
Figure 33 - Console output for collision detection........................................................82
Figure 34 - Drop-Off Platform......................................................................................85
Figure 35 - Drop Off Zone in action.............................................................................88
Figure 36 - Visual Representation of a Stack ...............................................................89
Figure 37 - Console Window Showing Stack Ouput after Successful Order................95
Figure 38 - Just a Concept for Level 2..........................................................................96
Figure 39 - Level 2 Design ...........................................................................................97
Figure 40 - 3D Room Model.........................................................................................98
Figure 41 - 3D Model in Unity Scene...........................................................................98
Figure 42 - Hierarchy of the Room...............................................................................99
Figure 43 - Design Sample of Storage and Collector Units........................................112
27. Unity 3D – Game Programming Intro
256
Figure 44 - User Interface Sample 1 ...........................................................................131
Figure 45 - User Interface Sample 2 ...........................................................................132
Figure 46 - Rect Tool Toolbar Buttons .......................................................................134
Figure 47 - Rect Transform Component .....................................................................135
Figure 48 - Pivot Interface ..........................................................................................135
Figure 49 - Anchor UI Elements .................................................................................136
Figure 50 - Preset Anchor Component........................................................................137
Figure 51 - Canvas with Panel Attached .....................................................................143
Figure 52 - UI Panel and Text Element.......................................................................145
Figure 53 - Collectables UI Implemented ...................................................................146
Figure 54 - Additional UI for Matching......................................................................147
Figure 55 - Additional UI Elements for Level 1 .........................................................148
Figure 56 - Button OnClick Event ..............................................................................149
Figure 57 - Level 2 Level Concept..............................................................................154
Figure 58 - Level 3 UI Concept ..................................................................................160
Figure 59 - Another UI Sample...................................................................................175
Figure 60 - Status Panel Background..........................................................................177
Figure 61 - Message Panel Background......................................................................177
Figure 62 - Enemy Panel Background ........................................................................177
Figure 63 - Panel Textures Applied to Level 3 ...........................................................178
Figure 64 - Level 3 UI Enhancement ..........................................................................179
Figure 65 - World Space Canvas Properties................................................................180
Figure 66 - UI Concept for Health Bar........................................................................182
Figure 67 - World Space Canvas Hierarchy................................................................182
Figure 68-Grid Sample Layout ...................................................................................185
Figure 69-Base Board Unit .........................................................................................187
Figure 70-Board Unit with Texture and UI Elements Applied....................................188
Figure 71-The Board...................................................................................................191
Figure 72-Showing Details per Board Unit.................................................................192
Figure 73 - BoardUnitPlayer Structure........................................................................196
Figure 74 - CubeWreck Prefab....................................................................................197
Figure 75 - Game Flow High Level ............................................................................199
Figure 76 - Player Ship Placement Flow Diagram ......................................................200
Figure 77 - A.I. Ship Placement Flow Diagram..........................................................201
Figure 78 - Game Play Logic ......................................................................................202
Figure 79 - Game GUI Concept ..................................................................................204
Figure 80 - Game GUI Score Display.........................................................................205
Figure 81 - User Interface - Player game piece placement..........................................248
Figure 82 - User Interface Game Play.........................................................................249
Figure 83 - Functions Ref. by Buttons ........................................................................251
28. Vahé Karamian
257
Appendix 2 – Code Block Table
Code Block Table
Code Block 1-variables assignment and data types ........................................................5
Code Block 2-if … else structure example .....................................................................5
Code Block 3 - Nested if..else statement ........................................................................6
Code Block 4-switch statement structure example .........................................................7
Code Block 5-loop structure samples ...........................................................................12
Code Block 6-example of a method..............................................................................13
Code Block 7 - Method parameter pass by reference ...................................................14
Code Block 8-simple calculator program demo............................................................16
Code Block 9 - Sample Car Class.................................................................................19
Code Block 10 - Car class using properties ..................................................................21
Code Block 11 - MyStack Data Structure.....................................................................27
Code Block 12 - Generics Code Sample.......................................................................28
Code Block 13 - Simple Event Handler Example.........................................................32
Code Block 14 - Car Class with Event handler.............................................................34
Code Block 15 - SerializeField for Inspector Window.................................................54
Code Block 16 - MyCollectable.cs listing ....................................................................77
Code Block 17 - PlayerInput() initial version...............................................................79
Code Block 18 - MyCollectable.cs ver 2 ......................................................................82
Code Block 19 - MyCollectableData.cs........................................................................83
Code Block 20 - PlayerInput.cs ver. 2 ..........................................................................84
Code Block 21 - PlayerInput.cs ver. 3 ..........................................................................88
Code Block 22 - Stack Data Structure ..........................................................................90
Code Block 23 - PlayerInput.cs ver. 4 ..........................................................................94
Code Block 24 - Room Selection Code Listing..........................................................100
Code Block 25 - Sliding Door Code Listing...............................................................102
Code Block 26 - RoomSelection Script Update to Include Timer ..............................105
Code Block 27 - PlayerInput.cs Update to include Timer Condition.........................107
Code Block 28 - SlidingDoor.cs Script update for Timer function.............................108
Code Block 29 - Room Visited addition to SlidingDorr.cs script...............................109
Code Block 30 - Addition to PlayerInput.cs script to handle rooms visited ...............110
Code Block 31 - MyStorage.cs initial version ............................................................114
Code Block 32 - MyCollector.cs version 1.................................................................116
Code Block 33 - MyResource.cs version 1.................................................................117
Code Block 34 - MyEnemy.cs version 1 ....................................................................121
Code Block 35 - PlayerInput.cs with Attack Enemy function ....................................126
Code Block 36 - MyEnemy.cs with Attack Function .................................................129
Code Block 37 - Level 1 Match Canvas Variables.....................................................148
Code Block 38 - Button triggers for Level 1...............................................................149
Code Block 39 - Level 2 Timer and Objective UI Code.............................................157
Code Block 40 - Revised RoomVisited() function for Level 2...................................159
Code Block 41 - MyStorage.cs Listing for UI Design................................................163
Code Block 42 - MyCollector.cs Listing for UI Design .............................................165
Code Block 43 - MyResource.cs Listing for UI Design .............................................166
29. Unity 3D – Game Programming Intro
258
Code Block 44-BoardUIVer1 Class Definition...........................................................189
Code Block 45-Creating the Board Dynamically........................................................190
Code Block 46-Highlighted Lines for Mouse Position and Raycasting ......................195
Code Block 47 - Listing for BoardUIVer1.cs..............................................................209
Code Block 48 - BoardVer1 Variables........................................................................214
Code Block 49 - Awake() function in BoardVer1 class ..............................................218
Code Block 50 - Start() function in BoardVer1 class..................................................220
Code Block 51 - Code for Construction of Player's Board..........................................221
Code Block 52 - Code for Enemy Board Construction ...............................................222
Code Block 53 - Update() function defined in BoardVer1 class .................................225
Code Block 54 - CheckPlayerBoard() Function Definition.........................................229
Code Block 55 - Temporary variables used by CheckPlayerBoard()..........................230
Code Block 56 - Determining what object we have hit by ray casting........................232
Code Block 57 - Visually placing the selected piece onto the game board .................236
Code Block 58 - Function for A.I. to place game pieces.............................................236
Code Block 59 - Function responsible for A.I. game piece placement........................238
Code Block 60 - CheckAttackBoard function listing..................................................243
Code Block 61 - Variables used by CheckAttackBoard() function.............................244
Code Block 62 - Registering a hit or a miss by the Player ..........................................245
Code Block 63 - Changing Turns after Player's selection ...........................................246
Code Block 64 - Function used to change the hit direction for the A.I. ......................247
Code Block 65 - Function to handle UI portion of ship placement by player .............250
Code Block 66 - Reset function listing........................................................................252
Code Block 67 - GUI Reset Function .........................................................................253