Showing posts with label Gameplay. Show all posts
Showing posts with label Gameplay. Show all posts

18 Mar 2014

Game Project Time.

Before on this blog


In November I tried to start a game project you can find some concept of it on this blog then shouted it down suddenly .

I don't even remember why, but mostly because it didn't look as something you can do in some free time.


Infinite Planning


In 2014 I decided to not take any kind of job and just dedicate myself to gamedev and hope to not die of starvation meanwhile.Two Months and a half are passed planning things out.

In these months I continued the design of some old projects ,but never seen a real opportunity to start them in a proper way, everything seem to be out of my possibilities lately.

Meanwhile I got some good time to experience with Project Anarchy and did various tests and I'm very happy with it and more confident in general as I don't have to worry about the tech.

As someone just know I'm also making some post shaders for the PC version(I hope that this week we will get a release date), but without a game to show the effects on my motivation on that project is not at its best, also because this doesn't help with starvation as I planned it to be a community project (a huge fail as now considered that no one applied to help me so far).

In this 2 months I have also tried to have an healthier life and I got very good results as I've lose 6cm of belt line fat so far and put 4kg of muscle weight at the same time.
This just to train myself to the hard work that will come and to put a better me in charge of taking care of my game dev goals.

6 Feb 2014

Normalizing and Tuning Two Axis Analogic Stick Input For Better Character Control.

Normalizing analogic axis Input in Project Anarchy.
This applies both to real controllers and touch ones ( es touchscreen tumblestick)

Unit Square vs Unit Circle

Analogic stick raw input is generally mapped to a unit square.

Using raw input with you controlled character makes it go faster in diagonal directions.

This maybe was ok  in the 80's ,but nowdays looks terrible.

To make their character move at the same speed in every direction most people use to normalize the direction vector.

Digital Vs Analog or Area vs Perimeter

Vector normalization introduces another issue with input.

You controls after vector normalization are no more analog.

Everything get mapped to the perimeter of the unit circle instead to just being constrained to the unit circle area.

While this is acceptable or even wanted in some cases , on the other hand in many other cases is good to have as much precision as possible.

As Project Anarchy comes with lua scriping I wanted to share the lua source to constrain movement to the unit circle area.

finaloffset is a  Vision.hkvVec3
offsetx and offesety are raw x and y axis.

finaloffset.x = offsetx * math.sqrt(1- (offsety * offsety)/2)
finaloffset.y = offsety * math.sqrt(1- (offsetx * offsetx)/2)

now you can use you finaloffset wherever you want with full analog precision.

You can also add a deadzone directly in the input mapping or after.

Analog Input Tuning

Input of this function is too linear for my taste so you generally want to map original offsetx and offsety to a curve tuned to give more control.

The simplest still very effective one is the exponential curve.

The most trivial way to make this input exponential is to write

offsetx = offsetx * offsetx * offsetx
offsety = offsety * offsety * offsety

Make this just before the normalization.


Offset are just multiplied 3 times by themself to not break the sign as Raw input is in the -1 to 1 range and have to stay in this range also after multiplications.

This gives you more control in the lower range of stick movement letting you to move the character with precision at lower speed then goes fast to the max speed.