• Subcribe to Our RSS Feed
Tagged with " HexDev"

HexDev Alpha Build 14

Dec 10, 2011   //   by Josh   //   Games  //  No Comments
Oh, and I posted a new HexDev Alpha Build tonight as well, because it’s been a while since I’ve updated it.
Quick feature list off the top of my head:
  • Ice
  • Penguins
  • Alligators
  • Bow & Arrow
  • Pickaxe
  • Mineable Copper Ore
  • Ash
  • Caves
  • Skeletons
  • Edit: Treasure Chests (with nothing in them and very cool audio)

Coming soon:  Banjos and Penguin mounts?

Simple Scrolling Combat Text with Unity3D

Dec 10, 2011   //   by Josh   //   Games, Tutorials, Unity3D  //  1 Comment

I found an interesting discussion on Eric Heimburg’s G+ page about “floaty numbers” in Unity, and offered to share my solution to this problem as seen in HexDev, so here it is! Maybe someone will come looking for Scrolling Combat Text in Unity and this code will help!

So to get things started, here’s a quick screenshot of the implementation in HexDev:

Concept

The basic concept is to display numbers above a unit whenever they take damage.  The number should rise for a certain height at a given speed and then poof away!  Nice and simple right?

So, to do this using my approach, we need a couple things:

  1. A Prefab with a TextMesh component attached.
  2. A Unit object with a MonoBehaviour attached that calls: SendMessage(“DamageTaken”, x);   where x is the number to be displayed.
  3. The ScrollingCombatText behaviour below attached to the GameObject that you want to display SCT numbers.

So, Step 1) In my projects, I have created a prefab called SCTText which looks like this:

Nothing fancy, again just a GameObject that has a TextMesh object on it.  The beauty of it is that you can change this prefab to have a mesh or particles or whatever you want on it.  The number will be updated by the ScrollingCombatText script below.

For step 2, all of my units have a special behaviour attached to them that manages their health.  Whenever they take damage, they simply use the Unity SendMessage API to notify other MonoBehaviour’s attached to the game object that the unit has taken damage.  This will probably need to be tailored to your project.

And for step 3, I just attach the script below to my GameObject, give it the Prefab we defined in step 1, configure some parameters and whenever the unit takes damge, voila!  Scrolling combat text!  Here’s what the configuration of the script looks like on my units (each unit can have their own values or we can use the default values):

Code – ScrollingCombatText

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
 
public class ScrollingCombatText : MonoBehaviour
{
	// How fast will the spawned text object rise
    public float RiseRate = 4.0f;
	// How high should the spawned text object rise
    public float RiseHeight = 10.0f;
 
	// Prefab with an attached TextMesh component that will be spawned when damage is taken
    public GameObject TextPrefab = null;
 
    private List floatingTextObjects = new List();
 
	// This will be the starting height of the floating numbers
	private float initialHeight = 0.0f;
 
	// Use this for initialization
	void Start ()
    {
		// If this component is attached to a CharacterController, use the CharacterController's height attribute to set the initial height
		CharacterController charController = gameObject.GetComponent();
		if (charController != null)
			initialHeight = charController.height;
	}
 
	// Requires the GameObject to have a method call to: SendMessage("DamageTaken", int)
    void DamageTaken(int damageAmount)
    {
		// Create a new text object and set the starting height and text
        GameObject textInstance = (GameObject)Instantiate(TextPrefab);
        textInstance.transform.parent = gameObject.transform;
        textInstance.transform.localPosition = new Vector3(0, initialHeight, 0);
 
        TextMesh mesh = textInstance.GetComponent<TextMesh>();
        mesh.text = damageAmount.ToString();
 
		// Add to the list of floating text objects to update every frame
        floatingTextObjects.Add(textInstance);
    }
 
	// Update is called once per frame
    void Update()
    {
		// Cache all text meshes to be deleted and later delete them
        List objectsToDelete = new List();
 
        foreach (GameObject floatingTextObject in floatingTextObjects)
        {
			float riseDelta = Time.deltaTime * RiseRate;
            Vector3 newPosition = new Vector3(floatingTextObject.transform.localPosition.x, floatingTextObject.transform.localPosition.y + riseDelta, floatingTextObject.transform.localPosition.z);
            floatingTextObject.transform.localPosition = newPosition;
            floatingTextObject.transform.LookAt(floatingTextObject.transform.position + Camera.mainCamera.transform.forward);
 
			// Delete this floating text object if it exceeds our RiseHeight property
            if (floatingTextObject.transform.localPosition.y &gt;= initialHeight + RiseHeight)
            {
                objectsToDelete.Add(floatingTextObject);
            }
        }
 
        foreach (GameObject objectToDelete in objectsToDelete)
        {
            floatingTextObjects.Remove(objectToDelete);
            Destroy(objectToDelete);
        }
    }
}

Cube Slime Mayhem!

Oct 31, 2011   //   by Josh   //   Games  //  No Comments

I’m having too much fun playing with Cube Slimes and Burning Trees!

Desining emergent gameplay is awesome! :)

HexDev on Kongregate

Oct 26, 2011   //   by Josh   //   Games  //  2 Comments

Attention loyal supporters of HexDev!

<crickets>

Ahem, ok, so I made the link to HexDev at the top point directly to the game on Kongregate.  This will help me save some web space and generate a bit of revenue (hahahaha), ahem… as I keep developing.  At some point, if Kongregate supports the Shared Content API for Unity, I’m ready to integrate it into the game so people can share custom maps.  Someday I may have to write my own content sharing API if they don’t deliver.

Here’s where you come in!  If you have a Kongregate account, I need a few more votes on the game to see how people like it so far.  The problem with Kongregate is that once games fall off the “new” list, they never get seen again, unless they are 5/5 star games which make the front page.  But at the same time, that makes sense for their business because a lot of garbage and prototype stuff gets put there, so they have to.

So, long story short:

  1. Go vote for HexDev on Kongregate! (so I can see the score)
  2. If you dislike this change for any reason, comment below so I can reconsider the change.

Thanks!

HexDev in Surround Sound!

Oct 26, 2011   //   by Josh   //   Games  //  No Comments

Posted a new HexDev build with sound! Filesize went up quite a bit. Also debugging ore collection, so if you place any mountain tiles, you might see some ore spawn. Right click to gather, but that’s all you can do for now.

Oh, and I reverted some of the graphics back to smooth shading instead of flat shading to get the nice outlines.  I think I like it.

Enjoy!

Designer’s Notebook

Oct 26, 2011   //   by Josh   //   Games  //  No Comments

I’m starting to work on implementing a resource gathering system for the game, because I think it’s fun to collect things in an RPG.  At the moment, my current design plan is to have Mountain Tiles spawn Ore Nodes which can be harvested and returned to the Blacksmith so he can produce metal for things like Swords!  All of this got me thinking more about dependency chains with my current set of tiles.  So here’s a quick graph that shows some of HexDev’s tiles and their interactions:

I guess there’s a couple things to point out about this sytem:

  1. Some tiles don’t interact with anything yet.  Water for example is utterly worthless aside from aesthetics at the moment.  Swamp tiles (while they have an added DoT feature) also do not interact with other tiles.
  2. The tiles that do interact and pretty linear or are 1:1.  Forests for example only produce content that is consumed by Library tiles.  1 without the other is kinda lame.  Same goes for Grass and the Bounty Camp tile.

I’m not exactly sure where I’m going with this, but my thought is to provide more tile:tile interaction possibilities, so that different tiles can interact.  Some off the top of my head ideas:

  1. A Forest tile next to a Swamp makes the trees corrupted and come to life as treants.
  2. If trees can be harvested, putting a forest next to water will make the trees regrow. (Thanks to Geti from TIGSource for that idea)
  3. Crystals from forests can be taken to the blacksmith, where he can forge it into a unique item that gives a new ability or a special item.
  4. Swamps can spawn items that give players objectives or reasons to enter them, maybe even spawn some creatures for the Bounty Hunter to desire.

I guess I want to avoid just going to town creating new enemy units and clever ways to defeat them.  I want the game to be more than just smash the enemies, and designing a system to create emergent gameplay is tricky.  I’m super un-experienced at this and I don’t have as much time as I would like to work on it, but that’s what’s on my mind! :)

New HexDev Tiles!

Oct 20, 2011   //   by Josh   //   Games  //  No Comments

In the last week or so, I’ve been extremely busy with other things, but managed to implement 2 new Tiles with 2 new game mechanics! :)

Swamp

Game Mechanic: Poison AoE
Description: Swamps are poisonous tiles that deal damage over time while the user is within the noxious gas that the tile emits.  Don’t linger too long!
Future Mechanic: Possibly adding a mob spawner or an item spawner to give players a reason to enter swamps.

Mountain

Game Mechanic:  Obstruction
Description: Mountains are simply “pretty” obstructions” that prevent players from passing through the tile.  This allows TileSet designers to create divides or paths that the player must walk around or through.

Until next time!  Happy Hexing!

HexDev Gauntlet!

Oct 12, 2011   //   by Josh   //   Games  //  No Comments

Posted a new build with the updates that I mentioned in my last post.  With this build, you get not only 1 new Debug Quest, you get 2!   Try em out, comments below if you have feedback.

Thanks!

Try Gauntlet Now!

Progress, Polish, and Physics

Oct 11, 2011   //   by Josh   //   Games  //  No Comments

No new builds lately because I’ve been working on quite a few small features. Here’s a brief list of things I’ve been working on and you can expect to see in the next patch.  Thanks to everyone who supplied feedback so far, it’s been really helpful!

Quests

  • Added Debug Quest 2 – Collecting Items.
  • Quests now highlight in yellow when they are complete.

Combat

  • Weapon Proficiency – Your skill with “bare hands” now improves over time as you defeat enemy units using it.  At the moment, every 5 points in proficiency gains you 1 new combo counter.
  • Action spam clicky support – I got some feedback about the combat system.  1 person summed it all up: “If I’m not holding down the mouse button, I’m doing it wrong.”  And I think that person was absolutely right.  So, I’ve revised the mechanics a little bit to allow combos even if you’re not holding down the mouse button.  I’ve done this by adding a small delay in between combo attacks.  If you have more combo points available in your combo chain, a small delay will be started (for example 1 second).  Within that 1 second timeframe, if you attack again, it will continue the combo.  I think this does 2 things:  1) it allows you to spam click because the tolerance window is much greater and 2) it allows you to time your combos if you want to elongate a combo chain for some reason (probably more valuable later when certain attacks can stun or knockback).

Game Mechanics

  • The game now supports 5 saved worlds instead of 3.
  • An Inventory System – To support Debug Quest 2 and the item collection mechanics.
  • Carrying items – Added support for “carrying” items as well. (like pots in Zelda).
  • Physics Based Mechanics – Just messing around today, I added a sphere with a rigidbody in town and I spent a good 20 minutes today kicking around this soccer ball with my little avatar and I had a ton of fun, so I want to add more things like this.  So, maybe town tiles will spawn children that play soccer and want you to play with them or maybe add a castle with physics based walls that you need to crash down to get in?

So, I leave you with a screenshot of the avatar carrying the crystal.

HexDev Alpha Gameplay Video

Oct 10, 2011   //   by Josh   //   Games  //  No Comments

This weekend, I let my 4 1/2 year old son play HexDev while I was working on some new gameplay mechanics (none of those are really shown here). While he was playing, I documented his thoughts and captured his experience on video to share.

Some of his thoughts (not shown on the video):

  • It needs a tile # 9 and tile # 10 – He wants a train.  (Spirit Tracks?)
  • He creatively surrounded the graveyard tiles with water so “you have to cross water to get there”.
  • Seeing a bunch of purple slimes spawn right next to him made him exclaim “wow!” when entering gameplay mode.
  • He doesn’t like bomb towers, so he didn’t add any. Although, he did come around after playing for a little bit and decided he wanted to add some the next time.

Here’s his experience. I personally like the last 15 seconds. ;)

Pages:123»