Catalogue

Monday, July 25, 2016

Scripting 4: AI: VeluciDrake

Speeddrake_AI is the script used to control VeluciDrake.


This is an overview of the Speeddrake_AI Script.


The string "personality" greatly controls the velocidrake's actions, colored orange.

Coward: Will run away when the player is standing too close.
Savage: Will attack the player from any distance.
Guard: Will not leave past a specific zone.
Persist: Will follow the player relentlessly.
Agile: Will jump over and avoid projectiles.
VOID Start()  Reads and stores component variables.
VOID OnEnable()  Resets AI states
VOID Update()  Controls the meat of the AI.
  • Sets basic variables
  • Checks distance from player.
    • Most vDrakes become inactive if too far away.
    • Persist vDrakes will instead chase after the player.
    • Guard vDrakes will check the distance from the guardzone instead of itself.
  • Agile vDrakes check around themselves for incoming projectiles, and will jump into the air if there are any incoming threats. If the threat is too high, they will instead attempt to drop lower to the ground.
  • Basic functions are then called. There are 4 wall checking variables, to test whether or not the vDrake is on a wall.
    • The wallhitx variables check for standing on walls.
    • The wallcheckx variables check the distance to the hit wall, and positions the vDrake appropriately.
  • The floor underneath the vDrake is then checked. If in the air, and not on a wall, the vDrake will be affected by gravity.
  • Now the script checks to ensure the player is within the vDrake's attack field, and their position. 
  • Guard vDrakes at this point check their distance to their guard point, and Retreat if too far away.
  • The following action is randomized by a variable between 0 and 5.
    • Climb will jump backwards to go up a wall.
    • Fall will jump down from the wall, or move closer to the player.
    • Attack will tackle the player, landing on the other side.
  • Debugging variables are checked last.
VOID wallChecknFace()  Checks for walls, and quickly sets the vDrake's position and facing direction based on the results.
 VOID circleCheck(LayerMask layerFloor, Vector2 chaseSpotT, LayerMask layerWall, Vector2 chaseMove) Creates a circle that moves and grows.
 VOID jumpToPoint(Vector2 jumpPoint, int jumpspd, float xspd, bool attackDash) rapidly moves the vDrake towards the desired point, found by circleCheck().
  VOID projectCheck() If the vDrake is agile, constantly checks for nearby projectiles through a circlecast.
  VOID actionMove (string currAct) Performs the desired action. 
 The string "currAct" controls the vDrake's action, colored red.
  • Attack: Will find a location behind the player, and tackle towards that spot.
    • If Savage the distance to be checked increases.
    • If Safe and Guard the vDrake instead retreats.
    • If Safe and isn't guard the vDrake instead attempt to Attack Safe.
  • Attack Safe: Will find a location between the vDrake and player, just to get closer.
  • Climb: Looks behind itself to find a wall that can be jumped on. This action happens quickly, and there is no prepping animation.
  • Fall: Similar to Climb, but looks instead to the front for a floor to land on.
  • RunAway: Finds any location behind the vDrake, and falls back.
    • If running away Fast, will increase the bubble's speed and decrease the prep time.
  • Retreat: Will jump back towards their guard location, used by Guarders.
  • After everything is checked, the variable curruentAction is reset to be blank.
  VOID OnTriggerStay2D(Collider2D other) Checks if colliding with the player.
If colliding with the player and tackling, the player will be damaged.

Monday, July 18, 2016

Blog 1: Summer Game Design Ideas Part 1

Summer classes have slowed down progress a bit, so most of the updates for the next few weeks will be scripts. I'm working on the game's graphics in the meantime.

Two events happened last week. The first is SGDQ, and the second is that I got my hands on an android. Both events have been inspiring some new game design ideas, though most of them are not very pertinent to Crown. I'll start with SGDQ, and talk about the Android games in my post 2 weeks from now. I've had SGDQ running in the background while I work on my school and project stuff, here are some of my thoughts.

My favorite run this year was Momodora 4: the commentary was great, the skill displayed was really impressive, the game itself is very high quality, and I got the most from it overall.  I'd love to make a metroidvania game at some point in my life, but I'll need to make sure I have the necessary resources when I try it.
Something more immediate though is a gameplay mechanic the runner described as "last hit forgivance. This means that losing all of your HP won't immediately kill you, but instead grants you one more hit. It hasn't been programmed in yet, but I plan to use it for Crown. I'm a bit wary about adding too many features that make the game easy, but I don't think I've crossed the line yet and games should support the player before the difficulty.
The Dark Souls-esque rolling ability also made me rethink one of Lily's powers in the game. But I'll explain more about that later on.

My favorite type of runs are the races and my favorite genre is platformers, so my most rewatched runs were the DKC Tropical Freeze and Super Mario Maker races. Both games showed off pretty good auto scrolling levels, something that will likely be very abundant in Crown as even the first major bossfight in the game is a running boss. The important thing is to keep the gameplay active and fast, something DKC and the Mario Maker speedrun level designers accomplish well.

Ape Escape is one of my all time favorite games, so I'm happy to see it speedran at a gdq event. The floating ability with Spike's slingback shooter reminds me of Razputin from Psychonaut's floating ability, almost tempts me to add dumb little tricks like that in my own games. That's probably not a great idea, but it reminds me how I love messing with cheat codes in games. Though I've already programmed a debug menu in Crown that I plan to make an unlockable feature for the player, so I think I at least have the fun factor that comes with cheating down.

Honorable Mentions: I just don't have much to say about these.
Ty the Tasmanian Tiger: Fun commentary.
New Super Mario Bros 1 and 2: I keep forgetting these games exist.
Kirby & the Amazing Mirror: I've been wanting to see a co-op run of this game.
Ed, Edd, 'n Eddy The Mis-Edventures: Love the show, never seen gameplay of this before.


If you're interested in what I do, here are my other social media pages:
Twitter @Maakole: I tweet whenever I update something here or on my Tumblr.
Tumblr: I made it recently, and don't really plan to use it all that often. But it will showcase art work from my Evanlily game projects, or whatever else I happen to be doing.

Monday, July 11, 2016

Scripting 3: AI: Fansher_AI

Fansher_AI is the script used to control Fanshers.
This is an overview of the Fansher_AI Script.
VOID Start()  Meant to be used only once to mark initial variables.
guardlock: records the initial position. Used for guardian fanshers who only patrol the area around their spawn point.
body: The rigidbody2D attached to the fansher, there isn't one by default.
truemaxspeed: Records the initial maxspeed.
shotref: Provides a link to the Shooter_AI script.
anim: Links to the object's animator component.
zpos: The z position, used to decide the enemy's depth.
sizer: The enemy's scale. Is set to the enemy's initial x scale
VOID Update() The meat of the script. 
  • Basic info is first retrieved. Para and hpRef are set to read the para, enemyHP, hurt, and canBeControlled are set based on the counterpart variables within the Enemy_Health script.
  • Acceleration is set to (1+Mathf.Abs(hspeed)*baseaccel)/3. So the fansher's speed increases at a slower rate the faster it moves.
After this, the four wants(direction) variables are read, and movement is decided based on their values. Fspeed (vertical) always adds double acceleration. Hspeed (horizontal) adds x1, or x3 if the Fansher is flying towards the opposite direction at the time.
Fspeed and Hspeed are stopped separately through lerping to 0 by 0.95f.
Final movements are set through:

transform.Translate(Vector2.right * truemaxspeed/2 * 0.01f * 100 * Time.deltaTime);
transform.Translate(Vector3.up * fspeed * truemaxspeed/2 * Time.deltaTime);
  • A circlecast is used to check the distance between the enemy and player. If the player exits the circle's radius, the enemy object becomes inactive.
  • Another circlecast is used to check if the player is within the Fansher's line of sight. 
  • A raycast is used to ensure the Fansher avoids being too close to water.
  • If the player is within the Fansher's line of site, the Fansher will call ProjectChoose() randomly based on Random.Range(0, bulletchance).
  • Finally, the debugging variable "wantsToMove" is checked, and the AI variables are set according to the debug commands.
IEnumerator ProjectChoose() The meat of the script. 
  • The shot prepping animation is set to let the player know the fansher is about to fire. 
  • hspeed and fspeed are both multiplied by 0.5f to slow down the fansher.
  • body.velocity is set to vector2.zero.
  • Waits for a customizable amount of time "bulletTossWait." 
  • Activates shotRef.ProjectChoose(); on the Shooter_AI script.

Monday, July 4, 2016

Enemy Design 2: VeluciDrake


VeluciDrake


Classification: Monster, drake.
Appearance: Lucent yellow bodies, dark stomach and feet, irisless eyes.
Diet: Carnivorous.
Location: Caves, Mountains, Forests.
Attacks: Lightning tackle.
Threat Level: 2. Very fast, but left vulnerable during attacks.

Adapt at general mobility, VeluciDrake are speedy monsters known for their running and jumping capabilities. When in full speed, the vein on the side of their body can release built up electricity.


Their feet have microscopic hairs underneath, which allow them to stick to almost any surface. To take full advantage of this ability, VeluciDrake mainly inhabit arching habitats, and due to their lucent scales are most commonly found in caves.



Like most Drakes, they hunt for larger creatures in packs. VeluciDrake attack by moving at high speeds toward their prey, this causes their bodies to naturally release electricity which can slice through other creatures like a blade.