May 7

Week 7 was filled with life so nothing was done on this project. Hopefully I will have some time this weekend. Fingers crossed!


Apr 28

Web playable version.

Not much progress has been made this week. Too much time has been spent on other stuff. I at least got some minor stuff done.

  • The mode problem fixed, so you can now switch between FPS mode and third person mode (1,2,3,4).
  • Raycast in FPS-mode, shoots in looking direction (when searching for usables and pickables)
  • Show Inventory started, but got some unexpected problems with the GUI. The bag moves when rotating…

Apr 21

Web playable version

I’m still doing basic stuff such as player control and camera control. I hope I can start going forward with the game logic next week and add another level. I’m rearranging internal scripts atm, so FPS mode is not working in this version.

  • Fixed a bug with player graphics direction when switching between different modes.
  • Mecanim: Followed the tutorial at http://video.unity3d.com/video/7362044/unity-40-mecanim-animation-tutorial. It’s quite nice, the way you can blend animations. Notice how if you wave and run (shift) or run+jump simultaneously it will still wave.
  • Added a little animation when picking up objects. Can’t seem to get the arms animation to stop though. Could be a pro feature.
  • Wave on key R.
  • Lerping the camera zoom in third person mode, to have a smoother movement.

 

So my TODO list is currently looking like this, but the bottom one will have a low priority and probably some new higher ones will be added next week.

  1. Raycast: Shoot it straight down from head and 1m out.
  2. Raycast: When in FPS mode, it should shoot from camera/head and in the looking direction. Cross in the middle?
  3. Show Inventory.
  4. Level clear: When reaching the goal, show some congratulations and move on to next level.
  5. Carry objects: Carry the object above the head? Carry it straight out like now, but with physics so it blocks (harder to fix).
  6. Skyboxes: Different skyboxes for different worlds to set the mood.
  7. Third person camera: Needs to handle objects in the way in between player and camera. Either move camera closer to player or make objects in between transparent.
  8. Virtual Joystick: For touch devices, a virtual joystick should be used in fps mode.
  9. Splitscreen touch device: 2-player split screen should have a 180 degrees rotation for second player for ultimate play on touch pad.

 


Apr 14

Playable Web version
Changes:

  • Changed usage of UsableObjects to always have trigger area the player must stand in, and then player must look at the object to use it. Look to use is done with a Raycast on Usable layer.
  • Added a Pickable layer for picking up objects. This raycast is done every frame. If it is too expensive, I’ll set the raycast at 5fps.
  • New key for using objects and picking up/dropping objects: E
  • Added a shadow on the player using a Projector in orthographic mode. Or should the shadow get larger when jumping (perspective mode)? Also added fake projector shadows on platforms.
  • Sound played when picking up key and opening door.

The carrying of objects is not the best at the moment. Just lift up the object in the air and parent it to the player with physics off. This has some unwanted (?) sideeffects of moving that object through the wall. Also it will get stuck on the movable platform. Also… it is visually in the way. Perhaps it could be semi-transparent.

The raycast is casting its ray from the head diagonally down. This might miss small objects, so not sure if I should cast it from the head and 1m out to straight down to the ground instead. I think it might work better. The raycast for picking objects has same problem, casting it from the feet and straight out 1m. Will miss stuff that is not on the ground. Will experiment with this next week.

 

This is the TODO list:

  1. Carry objects: Carry the object above the head? Carry it straight out like now, but with physics so it blocks (harder to fix?).
  2. Raycast: Shoot it straight down from head and 1m out.
  3. Raycast: When in FPS mode, it should shoot from camera/head and in the looking direction. Cross in the middle?
  4. Level clear: When reaching the goal, show some congratulations and move on to next level.
  5. Skyboxes: I want different skyboxes for different worlds to set the mood.
  6. Third person camera: Needs to handle objects in the way in between player and camera. Either move camera closer to player or make objects in between transparent.
  7. Mecanim: The Mecanim system will be used for animating instead, as it is much more versatile. One mecanim animation should be usable on all models. Speed should match player speed, so it won’t look like the player is floating.
  8. Virtual Joystick: For touch devices, a virtual joystick should be used in fps mode.
  9. Splitscreen touch device: 2-player split screen should have a 180 degrees rotation for second player for ultimate play on touch pad.

Apr 8

I’ve implemented a RayCast:ing version of finding out if a UsableObject is in front of the player. This is done by casting a ray from the players position 1 meter forward. If it hits anything on the layer Usable, it knows an object is on front.

The old version was by having a trigger collider that sensed if the player entered its area.

Differences positive or negative?
RayCast: When turning around the door will not be sensed, because the player won’t “see” it.
Old: Opposite. While the player is in the trigger area it will be sensed.

The Raycast method does seem a bit more natural, but it also involved casting a ray every frame. Not sure if that is cpu intensive since I do not have a profiler (no pro version).

Try out the difference here. The left door is the new one. Raycast version

PS I just noticed something seems weird with this web version. Can’t change any settings or look up with the mouse. Will investigate later.


Apr 6

Controls are still the same as in week 2, but also the 4 key will do topdown camera mode and free control mode.

Changes from week 2:

  • Switched back to default model, so the jump animation is visible.
  • Added support for multiplayer splitscreen.
  • NGUI ui for usable objects. Try the door.
  • Changed skybox to something with a ground.
  • Switched terrain for a simpler level.
  • Start menu with settings (multiplayer splitscreen)
  • Dying takes you back to your spawn point.
  • Running with shift-key.

I do not have a second level yet, so clearing this level won’t take you to the next one. This will be implemented next week.

Currently my UsableObjects must have a box trigger collider for getting player to know if it is usable. I’ve been thinking that maybe I should use RayCast from the player and a small distance forward to get the usable objects instead. This would simplify creating usable objects, but might be unnecessary CPU work. I will try this out when I get my OUYA.

Playable web version (Requires Unity3D Web Player)

Screen Shot 2013-04-06 at 17.42.09


Apr 2

NGUI gui is progressing. I now have a nicer looking popup when moving to a usable object (door), and when the required items for using that object is in your inventory (when you have the key to the door), a USE-button will appear. When clicking that, the object is used (the door is opened).

I’m going to prettify the code some, then I will upload it this weekend, along with a new playable web version.
NGUI required items


Mar 31

* Got the jump animation to work for default character. But I switched model just for fun. I could not use old animations on new model, so I’ll have to check out the mecanim system some more.
* Point/Click control mode now works.
* Updated the WaypointsMover. Now can pause at each waypoint.
* Added a UsableObject class, which I use on the door. Go near the door and items missing to use the door will show at the top. Will you be able to open the door? 🙂

u,i,o,p: Changes camera mode.
j,k,l: Changed control mode.
1,2,3: A mix of control+camera mode, like it will be in the final game.

Next weeks focus will be on adding a gui with ngui. Also I will probably not use a terrain, but simpler objects and perhaps use a toon shader.

Web version of the project. (Requires Unity3D Web Player)


Mar 27

I’ve been swamped with work, but managed to put a few hours into this.
Been checking out Locomotion. Looks awesome, but might be overkill on phones. But I’m thinking of supporting both systems, Locomotion, and an easier standard CharacterMotor implementation.

I’ve mostly spent some time on my fourth controller type, Point/Click to move the player. I have a simple system up and running. After I’ve polished it, I will post the code. So now I have three camera modes and four controller modes. Not yet sure if I will allow the user to choose between them all, but probably.

It is soon time to see what limitations the phone versions have too, so I don’t spend too much time on a system that just won’t work.

PS. Hoping to get my OUYA soon, so I can test my project on my 3DTV.


Mar 20

Simplified SeekSteer and made my own script for moving objects between waypoints. The MovingPlatform now works much better.

/**
 * Attach to object. Moves object between waypoints.
 */
using UnityEngine;
using System.Collections;

public class WaypointsMover : MonoBehaviour {
    public Transform[] waypoints;
    public float waypointRadius = 1.0f;
    public bool loop = true;
    public float speed = 2.0f;

    private Vector3 currentHeading,targetHeading;
    private int targetwaypoint;
    private Transform _transform;

    protected void Start () {
		enabled = false;
        _transform = transform;
        if(waypoints.Length <= 0) {
            Debug.Log("No waypoints on " + name);
            enabled = false;
        }
        targetwaypoint = 0;
    }

    protected void Update() {
        if(Vector3.Distance(_transform.position, waypoints[targetwaypoint].position) <= waypointRadius) {
            targetwaypoint++;
            if(targetwaypoint >= waypoints.Length) {
                targetwaypoint = 0;
                if(!loop)
                    enabled = false;
            }
        }
		_transform.position = Vector3.MoveTowards(_transform.position, waypoints[targetwaypoint].position, Time.deltaTime * speed);
    }

    // Draws red line between waypoints, and sphere with radius
    public void OnDrawGizmos() {
        if(waypoints == null)
            return;

        for(int i=0;i< waypoints.Length;i++) {
    	    Gizmos.color = new Color(0.9f, 0, 0, 0.3f);
			Gizmos.DrawSphere(waypoints[i].position, waypointRadius);
	        Gizmos.color = Color.red;
            Vector3 pos = waypoints[i].position;
            if(i>0) {
                Vector3 prev = waypoints[i-1].position;
                Gizmos.DrawLine(prev,pos);
            }
        }
    }
}