26 Feb 2014

Generic Post Filter (actually blur, max and min) for Project Anarchy.

Today made an initial generic filter Actually it is implemented as post processor , but I planned to made it as helper class other posts can use to make intermediate textures.

It works at original half and quarter resolution in box(2 pass), hexagon(3 pass) and octagonal pattern(4 pass).


Actually permutations supports 3, 5 and 7 taps in a linear pattern.


Actual filters are box blur(even if esagonal and octagonal approximate gaussian blur), min and max.


It is implemented on both pc and mobile.


Next step I want to try downsampler and other non separable filters.


Downsampler to reduce flickering of hi frequency details when working at quarter resolution.

Half resolution doesn't really need it in my tests .

Built in glow make a simple pass for downscaling that effectively stop flickering in quarter res.

On the other hand my actual filter  just run the first pass of the chosen filter as downscaling shader.


This is an example of the Blur and Max filter downscale to quarter 5 tap in 4 passes box( hexagonal shape as you can see in the last picture).Bur is very smooth jpg actually destroys the quality of the picture.

24 Feb 2014

Project Anarchy improve the Glow Post Processing.

Time ago I tested the glow shader and noticed it isn't as slow as I  believed on mobile if you mantein a low number of iterations.

It actually use dependent texture read so maybe it can be further improved.(p.s. comment in shader says it doesn't really use dependent texture read even if shader it a bit harder to follow in all it's permutations).
Actual implementation seem to do 3 interpolated taps so probably my blur cannot be faster than that, at least for few iterations( i have to see if I can make a better blut with 1 pass and 5 or 6 taps).

I want to implement one with vertex shader interpolators instead to compute uv in pixel shader.

Glow is composed by the most % by a blur filter.

In the actual pipeline this blur is just used in the last glow pass where it merges with the scene.

I don't really like this choice so instead to simply change the shader I want to modify the post processing so that blur can be used multiple time and glow get calculated and added to the scene with other effects and not in it's own pass.

For the blur:

I have to check the max number of texture coordinates ( opengl es limit is of 32 float varings) , but on mobile better to stay within 8 texture coordinates.

I have two 2 main options.


  • A Separable gaussian blur with 5 to 8 taps linear filtered.



  • A 3Pass box blur up to 8 taps (linear filtered) with shape similar to gaussian after the third pass.
First task so will be to complete the blur shader.


.



21 Feb 2014

Basic renderer update for Project Anarchy (PC)

Hdr and multisampling was disabled for mobile render I added them for the community project to include additional rendering features and post fx to the pc version of your game.

Example is very simple and not so original.
All is made a bit extreme to evidence the clipping and the missing precision in the glowing of the normal version that totally miss to represent the extreme power of the lights.

Multisampling is enabled on both images but the resizing and compression doesn't make it  noticeable but it is there.



In this other test with fantasy scene there is a visible banding in the ldr version, banding is presnt also a bit in the sky of the hdr due to sky texture ,and jpg compression.Hdr one has MSAAx4.
After this test I have added in editor controls for texture filtering ,max anisotropy and mip lod.



20 Feb 2014

About Project Anarchy community project and economy of collaborations.

Today I was thinking a bit about an economic system(gamification elements could be added to make it more appealing and engaging) to run full or partial Project Anarchy community projects and collaborations to release in app market.

I look for some feedback about this system and someone that may help me to rewrite all  in a better form(expecially my bad english) and define proper rules and mechanics.

Free to Play with advertising is a common monetization strategy in mobile market and may come handy to manage this profit sharing, but other alternatives may be found in future(es crosspromotional) so other kind of games could be included in this kind of system.

An open souce system can be made to select a different service and account everytime an ad is requested in the app and sepecific user account get selected in turns based on an extabilished algorithm.

Every user who will partecipate to this initiative to get help with his project will receive a certain amount of share points.those will represent an actual number of ad views % of his app he intend to offer for help.

Those share points are limited at beginning so you may run a small project or just delegate small parts of your project.

Running successfull project (that get released) or completing tasks in other projects let you acquire the possibility to dispose of more share points on your next project on pair with trust.

He then will decide to emit tasks(for the entire project or just part of it) and specify the total value of his game in sharepoints(not bigger than his total reserve)representing 100% of his project and how many points he will reserve for the community tasks.

Bidding could be made between users who want to run that task for a certain number of share point taken from the points emitted for that project tasks based on their own evaluations.

The project runner will then select the better offer, assign the task and reward those points on accomplishing that get allocated in the worker personal reserve and setted up in the advertising system on game release.

System may not be perfect(we may change every part of it),not be 100% fair in every part of it(but remember that it is mostly made for helping others so they will "probably" be fair with you to continue to get helped from you and others) and maybethe system is not even cheats free, but it is based on acquired trustfullness so accumulating points, but not be trusted upon others is pointless as your point lose any value to the eyes of people.

as 1% in a game of a relieable person that deserves trust and make quality games have a greater value than a the 50% in a low qualitative game from a cheating person that generaly doesn't finish project or make really bad games.

Previously made code(as libraries or open source) and assets could be selected from a community repository and a share could be attributed to the original creator/s and contributors of the resource(es. it may require actual points to acquire the licence of use of a resource).

In future a system to bid sharepoints for money may be estabilished based on previous performance records(How much your points was worth in your previously released games).

Rules have to be defined well and possibly a good software platform have to be developed to run this system.


18 Feb 2014

Planning a Project Anarchy Pc Renderer project.

Project Anarchy has actually a cutting edge render for mobile, but it is also the only renderer it comes with.

Someone can argue that something that is cutting edge on 1w of mobile device power cannot make a good use of all the exceding gpu power of the pc platform.

Adding on this on pc you have just access to dx9 (dx11 is available only in the full pro version).

The constraint to work with dx9 and not on the latest api at first confused me a bit.
I feel like investing on rendering features for an old gen api was not a great future investment as I wasn't seeing it the right way.

I was not missing dx11 features that in my humble opinion are not a great deal in actual games even if something is moving lately.
Compute Saders are a great thing and gives room to lot of optimization ,but the actual state is that current games shows quite slower performances for a minor degree of improvement.Many optimization that seem so good on paper done with Compute Shader seem to work just under certain loads and conditions.

Many other new techniques that makes use of newer capabilities of dx11 seems to be more academical than pratical in a real game scenario.

What makes my feelings about writing a render for PA totally wrong was the lack of proper knowledge about how Project Anarchy renderer internally works.

It is totally flexible and configurable and makes you write your own render in approximately 20% of time than doing it from scratch and way more easier as it has a proper utility function for every evenience.
The best part is that everything is very api agnostic.

There isn't a big difference if you are working of console or mobile , for dx9 or dx11 you don't care too much.Stay in the limit of what are your platform capabilities  and everything works out of the box.

The kind of render effects you have or if you feature a forward or deferred render doesn't make a good render as having the kind of flexibility Project Anarchy gives you to make whatever technique you need in your game.

All is customizable nothing is hardcoded.

Its customizability and provided code lets you to write a whatever new renderer in (approximately) 20% of the time required to make normally one from scratch.

However many people don't have time or skills to write a shader or code a special effect and will never attempt to make a renderer of their own.

In my free time I'm starting experimenting with a pc renderer for Project Anarchy just for passion as mobile renderer is just as good for the kind of games I'll do(even on pc).

The main goal is to make simple plugins to make my and your games more appealing on pc(mainly by post processing).

But a long therm goal could be to make entire renderers with  complete working set of advanced shaders.

I want to receive some feedback about your rendering needs and if there are rendering and shaders enthusiasts that want to partecipate in the development.




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.