Saturday, December 20, 2014

Final Post Fall 2014

Ugh... Okay, sorry for not posting for most of the semester.  I just didn't feel like I was making any real progress with this once I ran into the problem of getting the mirrors to stop reflecting when the "light" was no longer shining on them.  It's still a problem I'm nowhere close to solving, but I've got to report something if I want a good grade.  Well, let's see what we have here...

Huh.  Looking back at my blog, I could've sworn I was further along before I stopped blogging.  Well, I suppose that's what I get for not keeping up.  I already took screenshots, and I'm not going back to take more.  I just hope these will suffice.

The push-block Blueprints haven't really changed, so I'm not showing them off.  Here's the start of the reflection code on the pushable mirrors.

This was originally designed to accept light from any one of four directions and reflect it in a ninety-degree angle counter-clockwise.  I figured this could be done with one Blueprint with the right model, or two copies of the same one with the models pointed in opposite directions, but I was pretty sure just rotating the blueprint was out of the question.  I still had issues with that approach, but I figured all I needed was one Blueprint that could be duplicated four times with only minor changes to the Nodes.  That way, I only had to send one with instructions on how to rig it up properly.  No need to mess with the settings, just connect and disconnect those four event nodes as necessary.  You only needed one.  Actually, having even two connected at once caused issues that I didn't have time to resolve any other way.
A closer view of the Blueprint.  Each mirror has four box components just for sensing the "light."  As you can see, one of the first things it does is throw a boolean switch so it knows which way to reflect.
Then it checks to make sure the sensor-boxes are being overlapped by a source of light, like the original shaft or another mirror.  When that happens, the boolean "isReflecting" is set to True.  I've had issues with commands being executed too many times, and this prevented that from happening.  It also serves other uses, too, but I still need it to resolve that issue.
This is where the main body of the reflection Blueprint starts.  I've tried using loops to get the Blueprint to constantly update itself, but Unreal would either freeze or return an "Infinite Loop" error and quit the game.  Event Tick occurs every time the game state updates, and here I use a Branch node and isReflecting to make sure it only does stuff when I want it to.  The first thing it does is destroy the reflection it hasn't made yet, because if it's at the end of the line you won't get to see it.  Then it determines its current location so it knows where reflection starts.
Then it remembers which way the light is supposed to go, and sets the coordinates for the end of the Line Trace I'm about to call.  Those integers are supposed to help the reflection point the right way, also, but it looks like I didn't need those nodes after all.

Here's the Line Trace.  It's purpose is to detect the first object the reflection hits so it doesn't go through it.

Then it calculates how far away that is, and converts said distance into a transform representing how long the reflection is going to be.  The calculations are still the same regardless of direction, but it needs to know whether the calculations are for the X axis or the Y axis.  It's twice the number of nodes you'd need otherwise, but I don't know an easier way to change axes.
Then, finally, it uses the transform data to create (or recreate) the two components of the reflection.  One is the Godray static mesh I snaked from the Blueprint Office demo in the Marketplace, the other is a box component.  Part of the complexity of the calculations involves these components being different sizes.  Since the transforms are relative, I have to divide the distance by the length of the mesh or else the length of the mesh will be multiplied by the distance rather than set to it.  Another consideration is that their origin points are in different locations.  Godray's is on its side, while the box's is at its center.  Thus, the box's origin point has to be placed at the midpoint of the distance to the next object.  Once these components are (re)created, they are set into respective variables to be destroyed when Event Tick occurs again.
But we're not done yet!  This is supposed to be how the Blueprint knows its not being reflected on anymore.  It doesn't work, which may or may not be due to ComponentEndOverlap not being able to detect when something that overlaps with it has been destroyed.  I eventually tried this with a transform component node instead of destroy and add nodes, but still destroyed the reflection when End Overlap occurred.  It destroyed the wrong reflection, and I didn't have time to figure out how to fix it.
Close up of the End Blueprint.  As you can see, it destroys the reflection one last time and sets isReflecting to False.  The issue isReflecting solved was that the reflection would initialize more than once, creating more reflections than destroy component could remove.  Now the reflection only initializes once and continues updating after that.  Even with the updating part, isReflecting is necessary to prevent extra reflections from occurring.
You see that white Material Sphere?  That's the rotating mirror.  In case I didn't say this before, an object that is both pushable and rotatable will change direction if it rotates while moving, so it was necessary to make two different mirrors.  The white sphere is actually invisible in-game, but I need it so I can tell where it is while I'm working on it.  You'll see a different Material Sphere in-game, which is chrome like the movable ones.  You'll be able to tell the difference by the vertical shaft of light being cast on it.
Since the rotating mirror starts off already reflecting, it doesn't need to be told when to reflect after play begins.  It also doesn't move, so it only needs to check where it is once.  Thus, Begin Play is used to initialize the reflection.  Also note it creates a chrome Material Sphere.
When you hit it with a projectile (or, in this case, something not identified as a light source or a character), it uses a Switch on Int node to change direction.  As you can see, the first thing it does is update the integer that tells it where to face next.
You may recognize this as the reflection initialization Blueprint from the moveable mirror.  As you can see, I determined I really only needed one boolean for this, but I still hadn't gotten past the integer thing.  I originally used a Set Rotation node here, but I thought it was choosing directions at random so instead I'm destroying and recreating the mirror instead.  It has been suggested to me that the Rotation may have been relative rather than absolute, but I haven't had a chance to test that theory yet.
Pretty much the same reflection updating code as the other mirror.
This is pretty much the only difference.  It doesn't stop reflecting, so there's no end Blueprint.

So let's see this stuff in action.  It's a little hard to tell, but the player character is using the My Projectile from the FPS demo, which has been altered to destroy itself on impact instead of bouncing around. It could still trigger Event Hit while bouncing around, so I put a stop to it.
Am I done now?  If you'll excuse me, I'm going to go lay down until Christmas.





Sunday, October 26, 2014

Push Mirror

So I took the pushable block and turned it into a mirror.  I think when I first posited this idea, I figured I'd be having the shaft of light spawn a second shaft when the mirror passed into it.  Simple enough, unless you need to make the mirrors turn around as well.  Instead, this mirror produces a shaft when it enters the light and puts it away when it leaves.  This way, the reflection can be redirected when the mirror turns.

Granted, there are issues when a pushable object is also turnable, but I assume that can be fixed or circumvented easily.  First, let's take a look at our mirror.


You may notice a couple of additions to the push sphere.  First is the box on top to act as a trigger volume to detect the light.  Actor Overlap wouldn't work with this for some reason.  Next, if you look carefully you may notice the cone hidden inside the sphere.  Using add component like with the shaft worked fine, but I couldn't figure out how to subtract it once it was there.  I could, however, use Destroy Component to get rid of the sphere itself.  Just so you know we can do that sort of thing.


Instead, we're using Set Static Mesh.  Now that I think about it, if the light isn't a static mesh this won't be very useful.  Hopefully, there's a counterpart for whatever we do end up using.  Anyway, Set Static Mesh changes the static mesh of the target object, and has a pull-down menu so you don't need some other widget to set that.  I set the target of the command by dragging the cone from Components list into the Target slot of the command.  OnComponentEndOverlap then triggers the command again with instructions to turn it back.

Let's see it in action:


The other doodad there is just to set off the overlap commands and doesn't have any actual commands of its own.

Next I tried making a destructible mesh, but I didn't think it warranted much explanation.  All you have to do is right-click on a static mesh in the content browser (I made a copy of one first, though I don't think it will be necessary) and select "Create Destructible Mesh."  It also opens a special editor window for it, and there's a tutorial there, too.  I tried testing it out, but I don't know how to cause damage with My Projectile yet.

Sunday, October 19, 2014

Pushable Object, Rotatable Object, "Reflecting Light"

Okay, I'm feeling a little behind here, but here are some things I made in Unreal 4 in the past couple of weeks.

Pushable Object


So our game is supposed to feature plants that the water gun can make grow and then act as platforms, jump pads, etc., but there is also a temple in the game. My big idea was that maybe there isn't enough light in the temple for the plant to grow, except under holes in the ceiling where light shines through.  Thing is, not all the plants are planted under shafts of light.  So how do you get the light to the plant?  With mirrors, of course!  Why are there mirrors in this temple?

...You ask too many questions, bub...

But just leaving the mirrors under the shafts of light would make things too easy!  It would be more fun (or at least time-consuming) if the players had to push the mirrors into the light.  Let's take a look at our mirror:
Okay, so it's not a mirror.  Sue me.  What matters are those boxes on either side.  At first I tried to use Blueprint to discern from what direction the player was approaching the object from, but I eventually gave up and just put boxes around the object.  Maybe that functionality exists in Unreal 4, but this should work for now.
This this is the Graph.  The thought occurs that there may be a more elegant solution than to use "Make Transform" and "Add Actor Local Transform," but it's getting kind a late and I only remember having issues with other commands (although that may have something to do with my trying to make the object both rotatable and pushable).  Anyway, you'll need one set of those for every box around the object so you can push it in any direction.  The Timeline component is to make sure the object doesn't just teleport to its destination.
 Double-click on the Timeline to open it's graph.  It'll put a little tab up there so you don't have to do that again.  Click "Add Vector Track" and it'll add a timeline here as well as a corresponding output on the component.  There'll be a red line at the bottom of the timeline, representing the X axis.  Shift+Click this to add Keyframes to the timeline, which has a "Time" variable and a "Value" variable (representing its location in this case).  You need two of these, one representing where the object is now (0 seconds and 0 distance away), and the other representing how far you want it to go and how fast.  The Value will be positive or negative depending on the direction.  There are also green and blue lines representing the Y and Z axises, respectively, for when you want the object going in those directions.  Click the eyes on the upper right of the timeline to make them visible or invisible.

Rotatable Object

Just pushing blocks too boring, you say?  How about if you had to rotate them, too!?  Well, I tried making it pushable and rotatable, but it just had a seizure when I tried to push it.  Then I put a component on it just for turning it, but turning it while it was moving made it change direction.  Might have to do with the "Local Transform" command.  I'll have to look into it.  Right now, I'm thinking it might be better to put a rotatable object on top of a separate, pushable object if you want to do both.  Might have to parent them or something.
Anywho...
 No boxes.  Doesn't really need it as long as it has collision already and you only want it to do one thing.  You'll notice that it's the same static mesh as the other object, which is why I put materials on them.
Pretty simple.  "Event Hit" allows it to trigger when hit by projectiles.  Unfortunately, it also triggers when hit by the player and I haven't figured out how to get it to differentiate between the two yet.  I tried using Timeline to make it turn gradually, but not only did it not work, but the first time I hit it caused it to continuously spin for a moment.  That's its first reaction whenever you start playing, but subsequent strikes generally responded normally.  It might be possible to get it to turn gradually, but I'll have to continue looking into it.


Reflectable Shaft of Light

I feel like I'm forgetting something... Oh, duh!  The shaft of light! Gotta reflect something, right?
Okay, it's actually a solid column.  It doesn't matter what I put in there, as long as there's a volume somewhere that will detect collisions.  This one just has a small one at the base.
You can find "OnComponentBeginOverlap" by right-clicking the component under "My Blueprints" and going to "Add Event."  The "Add Static Mesh" command is as easy as dragging the target asset into the Graph.  The Branch is there to make sure the shaft doesn't respond to the player touching it.  Make sure the Transform has the new component spawn at a different angle or location, or there'll just be two in the same place.

Want to see these Blueprints in action?  Of course you do!  TO YOUTUBE!

Using Kachujin in third person again.  I followed Marcus' "Third Person Shooter" instructions, and she looks even more gimpy.  The Mixamo characters have either shoot or throw animations, but I'll have to mess with shooting Blueprints to make it work right with them.

I'll keep you posted if I come up with more.








Monday, October 6, 2014

Stuff I Made This Week

Well, I didn't come up with any more puzzle ideas just yet, but I did manage to make a few things that might be helpful in the future.

First is a Teleporter.  Probably won't be used in this game, but they were the first things in my UDK notes and it was bothering me that they didn't come premade in Unreal 4.  They'll probably do that in a future update, but for now here is my blueprint.


My main problem was that I was pretty dense.  Teleport and Event Actor Begin Overlap weren't difficult to find, with the search function in the components list and all.  The steam is just a visual effect, but I couldn't get the overlap to work until I got that box in there.  Add Component > Shapes > Box.  I had thought it was just geometry when I first saw it, but after an aggravating tutorial search I discovered it was a bounding box or something.

Here's a video of it in action:
 
Oh, and I had installed the Mixamo character pack.  I happened to like this one, so I used her instead of the blue guy.

Next is the Jump Pad.  We'll probably be using this blueprint a lot.  Also annoying that they don't have a prefab of it yet.  I had to go to the Unreal 4 forums to find out how to do this, but the aggravation didn't start until I tried to find the components.  Sure, "Launch" seems obvious now, plus you can't find it in a search until you uncheck Context Sensitivity.  "Cast to Actor" was even worse.  It didn't show up in any search!  I had to find it manually.  Call Function > Utilities > Casting.  And you're going to need that, since "Actors" don't qualify as "Characters" for some reason, and it won't even compile without an input to the target.  It defaults to "Self," and while that may be cool for Teleporters it won't fly for Launchers. Pardon the pun.

 It didn't seem to work until I set the Z velocity to 1000.  I didn't really experiment with the numbers beyond adding zeroes to the end yet, so I don't know what the actual minimum is.  I can tell you, though, that there is no noticeable effect at 100.

You could say it looks like a marshmallow, but I think it kinda looks like a propane tank.  For the video below, I set it a bit into the ground so I could just walk onto it.  I also switched to the blue guy because the Mixamo characters just use their run animation in stead of their jump animation when they hit it.  It looked really weird, and I thought it might cause concerns if I used one of them for the video.


A week well spent, I must say.

Tuesday, September 30, 2014

Puzzle Ideas

So I'm in the puzzle-making department, and I have to post something to show how my work is progressing.  Let's see what I came up with:

Temple Puzzle Ideas
1. Ladder maze: Basically, a vertical maze along the walls of the temple with ladders, stairs, and gaps to jump over.
2. Light and Mirrors: One of the play mechanics involves spraying water onto plants to make them grow, which will then act as platforms, ladders, jump pads, etc.  There isn't a lot of sunlight in the temple, but there are holes in the ceiling in which visible shafts of light streak through.  The shafts of light do not necessarily correspond with the locations the plants, which won't grow without the light no matter how much water you spray it with, so the player would have to move mirrors (pushing or turning them) in order to bounce the light onto the plants.  There could even be a "bridge" plant that grows along the shaft of light to traverse a gap (either the mirror would have to be moved from afar using switches or whatever, or the plant can be watered from afar since it's a water gun).

...Yeah, that's about it.  I'll keep you apprized if I come up with anything else.

Friday, September 12, 2014

GDSMC Assignment 01 My Game Concepts

Last of the Immortals

Game High Concept: You can't win by force alone and must convince the bosses to surrender.
Genre: "Metroidvania"-style action-platformer
Main Character: Chryseis, a member of a pantheon of heroes known as the Twelve Immortals.  She is a Soul-type Immortal, whose body is mortal and upon death reincarnates as a new person with the same memories and powers (Similar to Avatar: The Last Airbender/Legend of Korra).  Having reincarnated fairly recently (by Immortal standards, at least.  She's an adult), her memories of her past lives are fairly hazy and she doesn't know the other Immortals as well as she should.  The other Immortals consider her a "Rookie," even though she has existed in various forms and walks of life for far longer than most of them.
Story and Objectives: The Twelve Immortals watch over Vertigo City, a modern metropolis built around an active volcano.  The player character, Chryseis, was out on an errand when a master super-villain attacked their headquarters.  She returned quickly, but was too late to prevent him from brainwashing the other Immortals with false memories and sending them out to conquer the city they once protected.  While Chryseis can hold her own against them, she is not strong to overpower them and must use her wits to talk them out of it.  By exploring the city, she can refresh her memories of important events in the lives of the Immortals that shaped who they are, then engage in dialogue-tree banter with the Immortals as they engage her in combat and use their memories to break their brainwashing.  Once all the Immortals have been freed, she can lead them into a final confrontation against the super villain.
Gameplay: The game is ostensibly side-scrolling, but areas can be explored in every direction with verticality achieved through jumping on platforms and climbing stairs and ladders.  Chryseis can defeat enemies (other than bosses) using various attacks, but is primarily equipped with swords and handguns.  She can also make observations about her immediate environment, which may reveal cutscenes depicting her memories, or to just taunt enemies.  In boss battles, the observation controls are instead used to banter, argue, and present evidence when prompted by another Immortal.
Proposed Controls (Assuming XBox One controller)
-Left Analogue Stick: Left/right to walk or run, up/down to climb ladders, down to duck (and crawl?)
-Right Analogue Stick: Attack. Move stick to swing sword, depress for auto-fire.
-A Button: Jump
-B, X, Y Buttons: Unlockable, equipable abilities.
-Left Shoulder Button: Describe Environment/Find Item/Recount Memory (the "Look" button)
-Right Shoulder Button: Sarcastic Comment/Taunt
-Left Trigger: Positive Comment/Compliment
-Right Trigger: Negative Comment/Insult

On-Rails Shooter

High Game Concept: It's a shooter.  On rails.  Often literally.
Genre: Arcade-style gallery-shooter
Main Character: You.  The player.  Admittedly, there's no real character here yet.
Story and Objectives: It's the far-off future of the year 1999, and Battle Coasters are sweeping the nation!  They're just like regular roller coasters, but with guns!  Some are on tracks and throw animatronic targets at you, while other are virtual, but the goal is always the same: Shoot Everything! Travel from theme park to amusement park to ride and shoot your way through various settings, from robots and aliens to cowboys and Indians!  Many Battle Coasters have multiple tracks, allowing you to compete and battle with other riders or switch tracks to negotiate alternate paths!  Each one ends with a monumental boss fight!  Beat it within the time limit to win big!
Gameplay: This game uses a fixed, first-person perspective (although the view can move automatically to look at different things).  If light-guns are unavailable, you can move the cross-hairs with the left control stick and fire with the right shoulder trigger.  Various targets/enemies move around the screen and the player is expected to shoot them down for points.  Some elements differ from coaster to coaster.  For instance, most "real" coasters use cut-outs and dummies as enemies that don't shoot back and the rider only gets one weapon, while virtual coasters tend to give the rider a life bar that enemies will deplete with their attacks and the rider may have access to multiple weapons.  Some virtual enemies can throw large, slow-moving attacks that players can shoot away from them, while other use the "Magic bullet" system where there may be dozens of enemies on-screen shooting at you but only one (with the "Magic bullet") can actually hurt the player.  Tracks with multiple rails may present the player with switches to shoot to change their path.  Some may be more obvious than others.  For instance, a train track tends to have an obvious switch by the side of the fork, whereas a cave slide may require you to shoot down a stalactite to alter your course.  Boss battles may vary, as well, with some tracks just dangling the boss in front of you while others wind around it.

Chimera Knight

High Game Concept: Pokémon meets Legend of Zelda. Recruit monsters that transform into armor and weaponry.
Genre: Action-Adventure, possibly with RPG elements.
Main Character: Katrina Arden, a small-town girl with dreams of becoming a big-time hero as a member of the Chimera Knights.  She is brash, cocky, and proud of her strength and abilities.  She dresses plainly and has her hair in a ponytail.
Story and Objectives: Ares is a planet that has been terraformed using nanotech Virobots controlled by massive machines called Terra Engines. Four exist within the scope of the game: Dionysus the Engine of Earth, Quinlong the Engine of Water, Ra the Engine of Fire, and Thor the Engine of Air, plus their control satellite Pantheon.  The Terra Engines are thought to have been long since dormant.
Meanwhile, an evil force has emerged called the Terrasites, small, horn-shaped parasites that use the Virobots within a living creature to exercise control over it.  Chimera Knight Rosecrucious Berg believes the Terra Engines may hold the key to eliminating the threat of Terrasite domination, and Katrina Arden has arbitrarily enlisted herself as his protege when he visited her town and joined his quest despite his protests.  Together, they must explore the inner workings of the Terra Engines and defeat the Terra Guardians to gain access to their controls, then board the Pantheon Satellite to execute the final program.
The Terrasites are not the only evil in this world.  The Lamarckian Initiative seeks to eliminate all of human kind, considering them to have upset the natural order of the universe by terraforming and colonizing other worlds and polluting Mother Earth.  To them, total extinction is the only solution.  The Chimera Knights seek to put a stop to their insane schemes before they wipe out all life on Ares and other worlds.
The creatures of this world are known as Totemic Beasts, or simply Totems.  Chimera Knights (and maybe people in general, I haven't decided) can merge with them in a process called Chimeric Fusion, transforming the Totems into equipment, armor, and weaponry.  Most people are only capable of forming the bond necessary to perform Chimeric Fusion with one or two Totems, but Katrina is gifted with the ability to fuse with multiple Totems at once, and with any Totem willing to join her.  Totems (and people) can be liberated from Terrasite control by ripping the horns off them.  Katrina may then visit Sanctuaries (some of which also have to be liberated) to recruit Totems she rescued, many of which require Katrina to do small side-quests first.
I'm considering a twist-ending where Berg is the final boss.
Gameplay:  There are five types of Totemic Beast: Weapon, Projectile, Armor, Shield, and Equipment.  Weapon types are for melee attacks, Projectile types are for ranged attacks, Shield types block attacks, Armor can reduce damage and, along with Equipment, can grant the player additional mobility and grant access to certain areas.
Totemic Beasts are also divided into nine elements: Neutral, Earth, Water, Fire, Air, Electric, Ice, Chemical, Mechanical, and Mystical. Some elements "trump" other elements, which affects the functioning of Totems.  Weapon and Projectile Totems do more damage to elements they trump and deal less damage to elements that trump them.  Similarly, Shield Totems cannot block attacks of elements that trump them, and some provide additional effects when blocking elements they trump.  Equipment Totems' primary functions generally aren't affected by elemental trumping, but any damage they cause is.
Katrina navigates the world by walking, running, jumping, and climbing, and can use certain Totems to get around or through obstacles.  There are even ones that allow her to fly. She can only have one Weapon, Projectile, Armor, and Shield-type Totems with her at one time (the number of different Equipment-type Totems she can have depend on how many subtypes we create), and can only actively use one Weapon/Projectile/Shield/Equipment-type per limb that can hold it (typically two, one per hand, unless something can fit elsewhere, such as Totems becoming footwear on her feet or a helmet on her head).
Katrina may have a number (two?) of allies fighting alongside her on screen, including Berg, maybe a loose Totem, and other characters I'll introduce/invent once we're actually working on this game.
Boss battles, especially against Terra Guardians, may be God of War/Shadow of the Colossus-like, where she has to climb all over them to find their weak points.