Unreal Script: An Introduction Parts 9 to 10 Brandon Holbert.

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Microsoft ® Office Outlook ® 2007 Training Retrieve, back up, or share messages Sweetwater ISD presents:
Princess & Dragon – Version 2 By Michael Hoyle under the direction of Professor Susan Rodger Duke University July 2012 Part 3: Billboards, Events, Sounds,
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Events Part III The event object. Learning Objectives By the end of this lecture, you should be able to: – Learn to use the hover() function – Work with.
Getting to know Greenfoot
Stopping cheaters since By: Tigran Gasparian.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Computer Training for Elders.  We make some assumptions about who you are: ◦ You are interested in using a computer for a few basic tasks (to begin with)
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
SE320: Introduction to Computer Games Week 8: Game Programming Gazihan Alankus.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
Line up By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0 Key Abstractions in Game Maker Foundations of Interactive Game Design Prof. Jim Whitehead.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
A 2-D, multi-player tank game developed in PLT Scheme ~ ~ ~ Ben VandenBos, Tim Reeves, Justin Hall, and John Ericksen ~ ~ ~ Senior Project - CS496 Spring.
Click your mouse for next slide Flash – Introduction and Startup Many times on websites you will see animations of various sorts Many of these are created.
GAME:IT Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game.
Making a Boat Racing Game in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2010.
VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT.
.:::The EA FEAR Division Presents:. When you download FEAR you should be able to load it pretty quickly, so if it’s taking long consider the problems.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Iteration. Adding CDs to Vic Stack In many of the programs you write, you would like to have a CD on the stack before the program runs. To do this, you.
CARLSON SOFTWARE CONFERENCE DANIEL V. SYPERSMA VICTOR GRAPHICS.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
10/9/20151 Unreal Basics CIS 488/588 Bruce R. Maxim UM-Dearborn.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
SharePoint document libraries I: Introduction to sharing files Sharjah Higher Colleges of Technology presents:
Booting Ubuntu Linux Live CSCI 130 – Fall 2008 Action Lab Dr. W. Jones.
Important UDK Classes How they fit together Copyright © 2015 – Curt Hill.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 What to do before class starts??? Download the sample database from the k: drive to the u: drive or to your flash drive. The database is named “FormBelmont.accdb”
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
1 ball, 2 ball, red ball, blue ball By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Game Maker – Getting Started What is Game Maker?.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Game Programming Patterns Game Loop From the book by Robert Nystrom
Warlords Patrick Levoshko SE 558 – Multiplayer Game Design.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
CHAPTER 14 Classes, Objects, and Games XNA Game Studio 4.0.
Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles
Copyright © 2015 Curt Hill UDK Animation with Kismet and Matinee Visual Scripting.
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
CS116 COMPILER ERRORS George Koutsogiannakis 1. How to work with compiler Errors The Compiler provide error messages to help you debug your code. The.
Repetition everywhere – comparing while in a method and as an event Susan Rodger Duke University July 2010.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
Introduction to: Python and OpenSesame FOR PROS. OpenSesame In OpenSesame you can add Python in-line codes which enables complex experiment. We will go.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
OVERVIEW: This section covers the functionalities of all important menus on the menu bar. Please Note: I will not go in full depth yet over every menu.
Installing a Moodle Test Site The painless and easy way.
Introducing Scratch Learning resources for the implementation of the scenario
How to develop a VoIP softphone in C# by using OZEKI VoIP SIP SDK This presentation demonstrates the first steps concerning to how to develop a fully-functional.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
By Melissa Dalis Professor Susan Rodger Duke University June 2011
Development Environment
Scratch for Interactivity
Cookies BIS1523 – Lecture 23.
Learning to program with Logo
More Selections BIS1523 – Lecture 9.
Fundamentals of Data Representation
creating a ecosystems model in net logo
Creating a Simple Game in Scratch
Presentation transcript:

Unreal Script: An Introduction Parts 9 to 10 Brandon Holbert

9. Networking In this section we’ll cover – Replication – Setting up LAN games

Networking, replication A good thing to understand when dealing with client server games is replication. That is to say what will be replicated on the server for all other players to see. You’ve notice we’ve used the keyword simulated for a few of the functions we’ve implemented. That keyword signifies that we have something in that function that doesn’t need to be replicated over the server to everyone else.

Networking, replication Replicating too many items would just bog the server down. There are many things with weapons aren’t replicated. Weapon firing sounds, weapon flash for starters. The client sees and hears those right away. A counter is generated a flash counter, hit counter for damage, and sound.

Networking, replication When the server runs through its tick functions for the actors the server is replicating it will call on those flashes and sounds. So needless to say this is a way to optimize the network architecture and prevents cheating. Where it used to be the case that a client could access what is seen, heard or whatever because they had access to what the server replicated.

Networking, LAN Creating a dedicated server – Open up the command prompt (run: cmd) Under the drive where your UDK folder exists – Cd udk – Cd (this case it was UDK ) – Cd binaries – Cd win32 (we can’t launch the 64 of udk) – Udk.exe server

Networking, LAN – And now you’ve launched a dedicated server. – One thing to note is if you have Steam running. Steam will try to authenticate your server and cause issues. So stop steam before you do this. – In the same command prompt run ipconfig and get your ip address. Your IPv4 address – We’re going over LAN right now, but this is very similar to a network setup that isn’t local. – You just need to get your ip address. That’s the key.

Networking, LAN Connecting to your dedicated server is simple. Launch udk and in the console type in “open ”

10. Mouse detection With the RTS starter kit from epic we’ll go over mouse detection and how the guys at epic implemented it.

Mouse detection There is also a mouse detection package you can download from udk but the rts mouse detection works differently. In an RTS game there needs to be a priority set for each type of object: enemy, friendly soldier, structures, etc… How the starter pack solves this is by creating “screen space boxes”

Mouse detection After these boxes were created on screen you check to see what your mouse pointer is intersecting and select the appropriate item based on the priority level. So the code is already implemented and we’ll walk through the key parts. We’ll start in UDKRTSMobileHUD.uc

Mouse detection // Calculate the screen bounding boxes for all of the resources for (i = 0; i < UDKRTSGameReplicationInfo.Resources.Leng th; ++i) { if (UDKRTSGameReplicationInfo.Resources[i] != None) { UDKRTSGameReplicationInfo.Resources[i].ScreenBoun dingBox = CalculateScreenBoundingBox(Self, UDKRTSGameReplicationInfo.Resources[i], UDKRTSGameReplicationInfo.Resources[i].Collisio nCylinder);

Mouse detection // Render the debug bounding box if (ShouldDisplayDebug('BoundingBoxes')) { Canvas.SetPos(UDKRTSGameReplicationInfo.Resources[i].ScreenBou ndingBox.Min.X, UDKRTSGameReplicationInfo.Resources[i].ScreenBoundingBox.Min.Y); Canvas.DrawColor = UDKRTSGameReplicationInfo.Resources[i].BoundingBoxColor; Canvas.DrawBox(UDKRTSGameReplicationInfo.Resources[i].ScreenBo undingBox.Max.X - UDKRTSGameReplicationInfo.Resources[i].ScreenBoundingBox.Min.X, UDKRTSGameReplicationInfo.Resources[i].ScreenBoundingBox.Max.Y - UDKRTSGameReplicationInfo.Resources[i].ScreenBoundingBox.Min.Y); }

Mouse detection That bit of code is from the function PostRender() Post render is done after everything has been rendered on the screen and this is a HUD class so that means after the HUD has been rendered. The function starts off by calling it’s parent post render and then checking to make sure it has objects like a player controller to interact with. Then it dives into that code snippet on the previous slide. That starts off by looking at all of the UDK resources in the game (UDKRTSResources).

Mouse detection For each resource that the RTS game is in control of it creates a bounding box by setting it’s bounding box property (Resources.ScreenBoundingBox). Which is a property for a UDKRTSResource. Among other properties like bounding box color. Now the bounding box is of type Box. Box (if we keep digging deeper) is a struct in the base class Object. This is a UDK Primitive. The box takes two vectors and a valid property. Vectors for where it is on the screen. Back to drawing the box on the screen.

Mouse detection So we set each bounding box for all of the resources. We do that by passing in the actor’s collision cylinder, the actor, and the HUD we’ll be drawing on. Based on the calculations in the function a box is created that represents the screen space that the actor’s collision boundary takes up, and the box has it’s properties set and is passed back.

Mouse detection Of course that sounds simple right? It is, don’t worry most of this low level UDK code so you should’ve have to worry about modding this. As long as your soldier, or structure, or whatever has a collision cylinder you’ll be able to draw a bounding box for it.

Mouse detection The rest of that for loop handles the actual drawing on the canvas. The top left position of the box (the 2D vectors (x,y)). The color for the box (which you can override but is by default to Orange. You can change that by calling the SetDrawColor function in Canvas.).

Mouse detection The last function called on the canvas draws the box on the screen and provides the coordinates for the bottom right coordinates. Next we’ll go over how the player controller processes the mouse input

Mouse detection // Inside UDKRTSPlayerController.uc function InternalOnInputTouch // Check if we touch any game play relevant objects if (PlayerReplicationInfo != None) { UDKRTSTeamInfo = UDKRTSTeamInfo(PlayerReplicationInfo.Team); if (UDKRTSTeamInfo != None) { UDKRTSMobileHUD = UDKRTSMobileHUD(MyHUD); if (UDKRTSMobileHUD != None) { // Are we touching a pawn? if (TouchEvent.Response == ETR_None && UDKRTSTeamInfo.Pawns.Length > 0) {

Mouse detection for (i = 0; i < UDKRTSTeamInfo.Pawns.Length; ++i) { if (UDKRTSTeamInfo.Pawns[i] != None && class'UDKRTSMobileHUD'.static.IsPointWithinBox(TouchLocation, UDKRTSTeamInfo.Pawns[i].ScreenBoundingBox) && TouchEvents.Find('AssociatedActor', UDKRTSTeamInfo.Pawns[i]) == INDEX_NONE) { UDKRTSTeamInfo.Pawns[i].Selected(); UDKRTSTeamInfo.Pawns[i].RegisterHUDActions(UDKRTSMobileHUD); TouchEvent.AssociatedActor = UDKRTSTeamInfo.Pawns[i]; TouchEvent.Response = ETR_Pawn; break; }

Mouse detection // Are we touching a structure if (TouchEvent.Response == ETR_None && UDKRTSTeamInfo.Structures.Length > 0) { for (i = 0; i < UDKRTSTeamInfo.Structures.Length; ++i) { if (class'UDKRTSMobileHUD'.static.IsPointWithinB ox(TouchLocation, UDKRTSTeamInfo.Structures[i].ScreenBoundingB ox) && TouchEvents.Find('AssociatedActor', UDKRTSTeamInfo.Structures[i]) == INDEX_NONE)

Mouse detection { UDKRTSTeamInfo.Structures[i].Selected(); UDKRTSTeamInfo.Structures[i].RegisterHUDActions(UDKRTSM obileHUD); TouchEvent.AssociatedActor = UDKRTSTeamInfo.Structures[i]; TouchEvent.Response = ETR_Structure; break; }

Mouse detection The player controller for the RTS starter kit handles the mouse over or “touches”. Function InternalOnInputTouch goes over how the player controller handles them. It’s a little more of a complicated segment but what it starts off doing is checking to see if there exists an already made way to handle this new touch.

Mouse detection Meaning “has this touch happened before?” “Is this the first time for this touch?” One of the parameter is a EZoneTouchEvent. Which is an enum and has values for “touch”, “update”, “stationary”, “UnTouch”, “cancelled”. This tells us the type of even we’re dealing with.

Mouse detection The function first checks to see if the type of touch is an “update” touch. If it was then it would check to see if this is a unique type of touch. That means if this is a list of touch events or it is a single touch event. Both ways call the function to process the input by calling ProcessInputTouch. That function looks at what type of touch it is and what that touch can handle.

Mouse detection Like Expaning the minimap. Which is an “update” touch type. Then InternalOnInputTouch handles “untouch” and “cancelled” touch types. Calls the same function ProcessInputTouch. Those touch types handle how you deselect an actor. Okay so the more important part to InternalOnInputTouch is how it processes a “touch” type. The part to get into if we moused over a bounding box for a gameplay object. The function IsPointWithinBox checks to see if we are hovered over a pawn and if so select it.

Mouse detection The same thing happens to structures next and so on. Those two blocks for Pawn and structure, show how the priority is set on what is selected. So what it says is if we selected a pawn exit this part of code (break call). If not a pawn or structure then it must be a resource.

Mouse detection The thing to take away is how to set the priority of your game objects and that each object’s bounding box can be checked to see if the mouse is intersecting it. That check is done by calling IsPointWithinBox in the UDKRTSHUD class. That method takes the bounding box that the game play object owns (defined in the HUD class) and the position of the mouse. It compares the position of the two and returns true or false based on that calculation.

Final thoughts Hopefully these slides have helped you gain a basic understanding of unreal script. Hopefully at first if you thought it was a difficult or an awkward language you now believe it to be something easy to understand. As easy as seeing how something was already implemented and modifying that to the way you want it.

Final thoughts Usript is an easy beast to tame and the UDK community is large and you can get so much feedback and answers to questions by doing a quick search. The only big issues is since it’s free there tends to be a lot bugs with config files resetting, or packages being improperly referenced, or off the wall compiler errors.

Final thoughts Don’t fret, just be aware of the fact that you’re on your own but you’re not the only one who has the issue. All issues are common, trust me. Thanks and hopefully you take this material and make something awesome. Until UE4 comes out which won’t use Unreal Script anymore (it’s C++)!

Good references UDN – – Great reference for Unreal Script UDK wiki – – Another great reference to cross-reference UDN and they provide different examples – Not the best and outdated, but it’s a community driven wiki Unreal script forums – Unrealscript Unrealscript – Best community site for a game developer Scaleform Menus – – I based the tutorial off of this, very simple 2D menu

Good references Scaleform HUD – – Hard to understand but simple to follow after you’ve created a menu 3DBuzz – – For everything else Unreal Expert – Good free misc tutorials – – Sometimes they post their paid tutorials in the free section. So it would be good to keep an eye on this. – The plasma rocket launcher tutorial is based off of one of their tutorials (Basic Unreal Script)