Sega 500 Making a Flamethrower Jeff “Ezeikeil” Giles

Slides:



Advertisements
Similar presentations
More on Classes Inheritance and Polymorphism
Advertisements

Sega 500 The UT2K3 Gunsmith Jeff “Ezeikeil” Giles
1 Computer Graphics Week6 –Basic Transformations- Translation & Scaling.
Chapter 16 Templates. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives  Function Templates  Syntax, defining 
1 Data Structures Data Structures Topic #2. 2 Today’s Agenda Data Abstraction –Given what we talked about last time, we need to step through an example.
Lecture 17: Animation Yoni Fridman 7/27/01 7/27/01.
CS 106 Introduction to Computer Science I 04 / 28 / 2010 Instructor: Michael Eckmann.
Microsoft ® Office PowerPoint ® 2003 Training Playing movies [Your company name] presents:
MrsBillinghurst. net A2 Computing A2 Computing Projects Game Animation in Pascal.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Introduction to Flash FYS100 Creative Discovery in Digital Art Forms Spring 2007 Burg.
Sega 500 Intro to Bot AI Jeff “Ezeikeil” Giles
Sega 500 How to get stuff into UT2003 Jeff “Ezeikeil” Giles
Timers in Unreal By Todd Brown. Setting up a timer Add ‘simulated function Timer()’ to your class Within this function, put the code for whatever you.
Bill's Amazing Content Rotator jQuery Content Rotator.
BIM211 – Visual Programming Objects, Collections, and Events 1.
CSE 380 – Computer Game Programming Box2D Box2D TestBed.
Sega 500 Close Combat weapons Jeff “Ezeikeil” Giles
Module 10: Simple Inheritance #1 2000/01Scientific Computing in OOCourse code 3C59 Module 10: Simple Inheritance In this module we will cover Inheritance.
Sega 500 More replication Jeff “Ezeikeil” Giles
Art 315 Lecture 5 Dr. J. Parker AB 606. Last time … We wrote our first program. We used a tool called GameMaker. The program we wrote causes a ball to.
Uses and features of multimedia products
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Important UDK Classes How they fit together Copyright © 2015 – Curt Hill.
Sega 500 Placing target boxes on the HUD Jeff “Ezeikeil” Giles
Programming games Show your version of Bo the dog. Start cannonball Preview: video, audio work session (cannonball) Homework: Cannonball with ball in a.
Moving Around in Scratch The Basics… -You do want to have Scratch open as you will be creating a program. -Follow the instructions and if you have questions.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
CS 106 Introduction to Computer Science I 04 / 23 / 2010 Instructor: Michael Eckmann.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
Looping and Counting Lecture 3 Hartmut Kaiser
Sega 500 An Introduction to Replication Jeff “Ezeikeil” Giles
Session 16 Pinball Game Construction Kit:. Pinball Version 1 Replaced the fire button with a mouse event. Multiple balls can be in the air at once. –Uses.
Sega 500 Mutators Jeff “Ezeikeil” Giles
1 CS161 Introduction to Computer Science Topic #9.
Sega 500 GUI & Menus Jeff “Ezeikeil” Giles
Introduction to Flash CSC361/661 Digital Media Spring 2007 Burg.
Sega 500 Creating a New Game Jeff “Ezeikeil” Giles
Point Sprites Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended.
Abstract Classes and Interfaces 5-Dec-15. Abstract methods You can declare an object without defining it: Person p; Similarly, you can declare a method.
Session 13 Pinball Game Construction Kit (Version 3):
M1G Introduction to Programming 2 5. Completing the program.
Matlab tutorial course Lesson 4: Writing your own functions: programming constructs
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
CS 106 Introduction to Computer Science I 04 / 18 / 2008 Instructor: Michael Eckmann.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Sega 500 Scripted events and Sequences Jeff “Ezeikeil” Giles
Sega 500 Combo Mutator Jeff “Ezeikeil” Giles
Sega 500 Precaching in UT2003 Jeff “Ezeikeil” Giles
Winter 2006CISC121 - Prof. McLeod1 Stuff No stuff today!
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
Sega 500 State Programming Jeff “Ezeikeil” Giles
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
Chapter 16 Templates Copyright © 2008 Pearson Addison-Wesley. All rights reserved.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Sega 500 More on Possession and Using Stuff Jeff “Ezeikeil” Giles
By: Cameron R and Ryan. Pros and cons Pros Cons Movement: It was easy to move the character around and to tell it where to go. Background: It was easy.
Sound and more Animations
FLOWCHARTS Part 1.
Today's Challenge: More Animation Storytelling and Scrolling!
Explode Tired of looking at Suzanne's ugly face? Itching to make her head explode? You've come to the right page. Just in case you're an animal lover though,
Object Oriented Programming COP3330 / CGS5409
Unreal Engine and C++ We’re finally at a point where we can start working in C++ with Unreal Engine To get everything set up for this properly, we’re going.
Editable Attributes (1)
CIS 488/588 Bruce R. Maxim UM-Dearborn
Matlab tutorial course
Templates Generic Programming.
Presentation transcript:

Sega 500 Making a Flamethrower Jeff “Ezeikeil” Giles

Last day We laid out the basic template of a weapon and how to modify / create one.

Today I had a real hard time deciding what kind of weapon to make But being a *bit* of a pyromaniac, I HAD to go for the Flamethrower.

Flamethrowers So, building on from yesterdays weapon template, creating a flamethrower is relatively easy. Surprinsingly, we need to modify only 1 file and create a 2 nd. Mod to the projectile Definition for “napalm”

Flamethrowers After all that work into setting up our weapon yesterday, one would have expected to have to make modifications to several, if not all of them. Actually, having to change only one or 2 files this is the bi-product of good ol’object oriented programming.

Flamethrowers So here’s the plan, We’ll keep using the linkgun mesh as the weapon and we’ll make all our modifications to the projectile. If you recall, we swapped out the projectile fired by out BoomStick to fire our own version of biogoo. Hence, we make all our changes there.

Flamethrowers I no longer wanted all the functionality of BioGel so I changed the parent class to Projectile. class BoomProj extends Projectile; But most of our core functionality still comes from BioGel, So Cut & paste what you need.

Flamethrowers In this case most of the variable declarations & defaults with the following changes: DefaultProperties { MyDamageType=class'DamTypeBoomStick‘ BaseDamage=10.0//reduced -eze Damage=10.0 //reduced –eze Skins(0)=FinalBlend'XEffectMat.RedShell'//make the goop red –eze LightHue=4//82 –eze …

Flamethrowers And we required the PostBeginPlay function to set our initial velocity of the napalm. So now we shoot red goo.

Flamethrowers But to this ain’t no flamethrower with out the flames…. So we add a couple of lines to the function local HitFlameBig BFlame; … //Spawn the flames & bind them to the goop -eze BFlame=spawn(class'HitFlameBig',,,,); BFlame.Setbase(Self);

Flamethrowers HitFlameBig is an xEmitter (a.k.a. a particle emitter ) and we’ve already seen the spawn function. But what’s Setbase? And why self?

Flamethrowers SetBase intrinsic(298) final function SetBase( actor NewBase ); Sets the actor’s Base. A base of None means that the actor moves alone; setting the base to another actor in the world causes this actor to move and rotate along with its base. An example of using a base is standing on a moving platform.

Flamethrowers Ah! So we bind it to ourselves…which in this case is the projectile. In effect you’re gluing the particle emitter to the projectile.

Flamethrowers Hey cool! Flaming goo! But at this point, it just works on impact damage.

Flamethrowers So we want to borrow 2 states form bioGel and make some modifications Flying and on ground. Most of both of these states I leave unchanged, we’re really interested in the process touch function.

Flamethrowers State Flying is for when the goo is airborn and has specific functionality for when it hits a wall. Processtouch we changed to this: simulated function ProcessTouch(Actor Other, Vector HitLocation) { if (Other != Instigator && Other.IsA('Pawn')) { TorchPawn(Pawn(other),HitLocation); //light the contacting pawn on fire.-eze }

Flamethrowers We’ll talk about TorchPawn in a sec… In State onGround, we made a similar change to the process touch. This state has all the functionality for when the goo is just sitting on a surface. Notice that it will actually drip from the ceiling.

Flamethrowers Also notice that the goo takes on different shapes when it airborne or on a wall… How does it do this?...it’s an animated mesh & we tell specific keyframes of that animation to be played.

Flamethrowers You can even open them up in the mesh browser. Notice the ugly Styrofoam texture and the key frames…

Flamethrowers By changing the skin 0 in the defaults, we can change the look & colour of our goo Skins(0)=FinalBlend'XEffectMat.RedShell‘ We can then play animations using various latent function calls.

Flamethrowers For example: PlayAnim('Drip', 0.66); In short, as long as there is a matching name, an animation will play.

Flamethrowers The 3 main functions we need to know about for playing animations. All of which are defined in the actor class as: PlayAnim LoopAnim FinishAnim

Flamethrowers PlayAnim intrinsic(259) final function PlayAnim( name Sequence, optional float Rate, optional float TweenTime ); Plays a named animation sequence in the actor’s Mesh once. The optional Rate scales the animation’s default rate. If a nonzero TweenTime is specified, the animation is first tweened from whatever is currently displayed to the start of the named animation sequence, before the animation sequence plays. When the animation playing completes, it stops and calls your optional AnimEnd() event and causes any latent FinishAnim() calls to return.

Flamethrowers LoopAnim Intrinsic(260) final function LoopAnim( name Sequence, optional float Rate, optional float TweenTime, optional float MinRate ); Loops the animation sequence forever. The AnimEnd() is called at the end of the sequence, and FinishAnim() calls return at the end of each iteration of the loop.

Flamethrowers FinishAnim intrinsic(261) final latent function FinishAnim(); Waits for the currently playing or looping animation to reach the end of the sequence

Flamethrowers And finally, what fun is a flamethrower if you can’t set your friends on fire. This is where our TorchPawn function comes in. In essence, this function does just that…set pawns on fire.

Flamethrowers StickyFire is a new class we created & we’ll talk about it in a moment. For now, think of it as our napalm. function TorchPawn(Pawn other, vector hitloc) { local StickyFire SFire; SFire=spawn(class'StickyFire',owner,,hitloc,); SFire.ToTorch(other, Instigator, hitloc); SFire.default.lifespan=lifespan; }

Flamethrowers This TorchPawn function is not really that fancy. In effect, it instantiates the napalm and sticks it to the pawn.

Flamethrowers Then we call a function in our sticky fire object to set up the pawn for the torching. ….I love mardi-gras…”bon homme carnival!”

Flamethrowers The Stickyfire class is in fact, our napalm. It’s the fire that we will stick to another pawn in the game. It’s been placed in it’s own class for 2 reasons. The first: is for good object orientation of the code…

Flamethrowers The second: it makes I real easy to have it do damage to the pawn as it now has it’s own “thread” of execution and specific functionality.

Flamethrowers Derived from pickup… class StickyFire extends Pickup; var pawn pother; //who we're stuck to var HitFlameBig BFlame; // the fire animation var int burnDamage; // damage per tick

Flamethrowers I chose to derive form pickup because it made the most sense. If you touch the flaming goo, you “pickup” the flames. However, we don’t want to spawn anything into the players inventory, after all. It’s not an item per-say. This is really easy, don’t set the InventoryType and it never adds to the pawns inventory.

Flamethrowers The first thing to consider is that ToTorch function which is how we light up the pawns: function ToTorch(actor toTorch, optional vector hitloc) { pother=pawn(toTorch); SetBase(pother); if(hitloc != vect(0,0,0)) SetLocation(hitloc); gotostate('FlameOn'); }

Flamethrowers This does nothing more than bind the fire to the pawn & changes states. function ToTorch(actor toTorch, optional vector hitloc) { pother=pawn(toTorch); SetBase(pother); if(hitloc != vect(0,0,0)) SetLocation(hitloc); gotostate('FlameOn'); } as in “Flame on Jonny”

Flamethrowers …sorry…had to make the comic book reference. Anyway, this 'FlameOn’ state is made up of only 2 functions…Beginstate & Timer.

Flamethrowers BeginState simply creates the fire effect, binds it to the player, sets how long it burns and the timer resolution. function Beginstate() { BFlame=spawn(class'HitFlameBig',,,,); BFlame.setlocation(pother.Location); BFlame.Setbase(pother); Bflame.default.LifeSpan=lifespan+2; SetTimer(1,True);//one sec intervals }

Flamethrowers SetTimer intrinsic(280) final function SetTimer( float NewTimerRate, bool bLoop ); Causes Timer() events every NewTimerRate seconds.

Flamethrowers And the timer, which gets called with every interval is defined like so: function Timer() { if( BFlame==none) { destroy();//flame has gone out... } //deal damage pother.TakeDamage(burnDamage, Instigator, pother.location, vect(0,0,0), class'DamTypeBoomStick'); }

Flamethrowers Now we can rain fire from the heavens…. WHEEE!!! I love the smell of naplam…smells like…victory.

Flamethrowers But we have a problem… Lots of accessed nones…

Flamethrowers Tracking this thing down takes us into the TorchPawn in our projectile SFire=spawn(class'StickyFire',owner,,hitloc,); SFire.ToTorch(other, hitloc); SFire.default.lifespan=lifespan; if(SFire==none) log("SFIRE");

Flamethrowers What the heck! I just created the object & it’s accessing none??? WHAT?!?!

Flamethrowers I refer you to the spawn function…

Flamethrowers Spawn intrinsic(278) final function actor Spawn(class SpawnClass, optional actor SpawnOwner, optional name SpawnTag, optional vector SpawnLocation, optional rotator SpawnRotation); Spawn an actor. Returns an actor of the specified class, not of class Actor (this is hard coded in the compiler). Returns None if the actor could not be spawned (either the actor wouldn't fit in the specified location, or the actor list is full). Defaults to spawning at the spawner's location.

Flamethrowers So Spawn couldn’t create the object! …Okay…why? There’s only a limited number of pickup objects allowed…exactly how many I don’t know.

Flamethrowers The solution… Change the parent class to actor. This also solves any inventory problems that could be incurred by defining it as a pickup.

Flamethrowers There’s only on issue left to solve… At this point, you can keep piling up the fire on the pawn & this can be expensive on the CPU…So we only want there to be ONE flame attached at any point.

Flamethrowers In the projectile class, we look for all the other stickyfires in existence, if we find one, we don’t create a new one. We just insert into the TorchPawn function local StickyFire SFire,otherfire; foreach allActors (class'StickyFire',otherfire) if(otherfire.Base == other ) { return; //bail if already burning }

Flamethrowers And voila! A pyromaniacs dream.

Go torch stuff That’s a wrap for today… For the remainder of the class, see if you can extent the burn time of the sickyfire for a pawn that’s already burning.