Thursday, December 5, 2019

Single handed shooter game prototype.

I was wondering how feasible it is to make a "twin stick" shooter game (a shooting game that uses two analog sticks on a controller, one for controlling movement, the other for aiming) but make it in such a way that can be played with only one hand. I'm pretty sure that there are people without full use of both hands that want to play games. So I was wondering how someone could design around this issue.

Noticing that gamepads can basically be cut in half and each side mirrors the other, the controls are also doing the same. Analog stick controls movement, and the bumpers are acting as modifiers, basically altering movement to allow for aiming or moving the tank. The triggers are doing the shooting, with the face buttons being mirrored by the directional pad on the left. (Haven't added any functionality to them yet, but ... they are four buttons and the pad can point in 4 directions and is oriented just like the face buttons...

(Better view the video in full screen.)

This wasn't to make a full game out of it, just see if i could control the tank and not get flustered by not being able to play the test well enough.

Sunday, February 3, 2019

Photogrammetry test.

Photogrammetry is a technique that allows you to take a bunch of photos of something, and with mathemagics to transform those 2D images into a 3D model.

It's a boring ant nest, but I'm happy with the result, given that i took 29 images. (The more the better.)

Use your mouse's scroll to zoom in and out, left click and drag to rotate the view, right click and drag to pan around. The "f" key will go full-screen and then back out.


(Direct link to the sketchfab page if you want to view it over there: https://skfb.ly/6GHuS )

Sunday, December 30, 2018

This took way longer than it should. (And what I *think* it taught me.)


*Hitting hand rhythmically on the table, shacking stuff...* This Took Longer Than It Should!

Now, what does that video show anyway? Just some text with a typing-in effect.
Yeah, that's the front of it, or rather one of the 4 versions of it. It's the dialog system that I wanted to make for a game.

There's a function that loads a dialog file created from my custom dialog editor, and the dialog function looks at the NPC, what kind of a dialog they are supposed to have, and enables the correct kind of screen to show said dialog. It can be either a simple "Hello" / "Hi, you ok?" kind of dialog, a long conversation, a dialog tree with available options as buttons and lastly, an interrogation mode. Where you can actually construct questions, and if those questions are something that the NPC has the answer to, they will reply accordingly.

"Vanilla stuff" you might say and you'd be right. But this is the first time I've been trying to make something like that and on top of that I had my ideas of what I wanted to have them do. First of all I wanted the function to be "NPC-agnostic." I didn't want to have to script stuff constantly, I just wanted to pass the name of the character you are talking to, along with some flags of what kind of a dialog it is, and have it come up. Standard stuff. But then I wanted to have the system do stuff like receive an item through dialog. Or enable a new dialog topic, mid-questioning. And then I wanted to have the system to be able to control the non-player character as well, for example, you said something to the NPC that they didn't like and that perhaps made them anxious, so their pose on screen should change. But what if I wanted to have something happen externally at a certain point during the dialog?! Like something blown up or a phone ringing! And of course, it should be able to jump from simple dialog to interrogation mode.
Or! Or ... what ever! The system should be agnostic to everything! Make it able to do *whatever* "I know how I'll do it! Every dialog line can have its own flags and codes embedded in it, and the system would check those codes while it's displaying the dialog, and fire off other functions and animations all over the place! Do all the things!"

People with experience know where this is leading up to. Bloaty, messy code. It does work now, but I noticed that I'm cleaning things as I go along, and with cleaning I mean selecting blocks of code and hitting "Del".

Since the dialog system in my mind was a single thing, I did just that. Made a big file with lots of functions in it, for the various dialog types.

NO! *table-hitting intensifies*.
Don't do that George. Had I asked around some more I think it would've been obvious that it will just make the code hard to follow when I would inevitably need to revisit it later on. A bunch of functions clumped up together without needing to talk to each other.
Since there are different flavours of the dialog, have a file for each dialog type with only the relevant functions to that type together. And for the dialog lines that were read from the file, just use a single struct to place them in and have it being read from the different dialog classes. It doesn't have for everything to be in the same class.


In the video just above, the first NPC is asking our main character to go and interrogate the other Character about stuff. (That Character's name is "Ch". Yes, I was feeling creative that night... Now that I think about it, it should be Ch1 and Ch2. Oh well.)

The video shows 3 different types of the dialog system at work, yes the visuals do need work and not all places have that "type-in" effect - but it's coming. It's a  caller-friggin-agnostic function now so all that needs to be done is to call it for that dialog panel...

Simple dialog, that unlocks the dialog tree type for the other character, which in turn leads to the interrogation mode.

*Hits table* Don't Make Monolithic Systems If You Don't Have To.

Oh btw, there's a ready made 3rd party system for dialog that could be utilized...
I guess it can be modified to do *all the things* and become monolithic blob if required. 

Sunday, July 22, 2018

Unity starter tips - performance.

"Uh oh. It's another one of those starter tips thing from people that thing they know game engines."
Yeah, it's one of those things. Things that I run into my self, and had to hunt them down all over the place when my projects had issues. Of course this is by no means the be-all-end-all list. But it is a start!

1) Remember to set up your project correctly in the Player Settings, set up skinning and batching depending on what you need (Leave batching on of course...), what to log...

2) Know your target platform. Not all platforms are created equal. You won't put the same effects (or the same quality effects) in PC and mobile. Mobile will just get single digit fps, if it will even work in the first place.

3) Set up your physics layers! If you have a physics layer for your player character and you know for sure that the character will never touch or interact in any way with objects belonging to a certain physics layer, disable their interaction in the physics matrix. There is no need to let the engine try to figure out if these two are touching since you know that they won't.

4) Bake stuff in maps! Even if you are targeting DirectX12/Vulkan with all the eye-candy possible, why waste cycles with having dynamic effects enabled for something that you know is going to be static? Bake those shadows and that occlusion. You'll take a tiny bit more to set them up, but you'll save on resources that you'll be able to use elsewhere and the people playing your game won't complain about fps drops.

5) Batch stuff! And Ι'm not talking only about dynamic batching because if abused, it may end up costing frames instead of saving. If you are making a detailed environment in a 3D modeling package, when it's time to export stuff, export all the stationary objects as one mesh, so when they go over in the real time engine then they will be treated as a single mesh.

6) Texture atlas. Continuing from #5, combine your textures for that scene into one big one, so when the engine goes to load the textures it won't go like "stop rendering, read from disk, load into memory" for every single texture. Sure you can't combine eeeeverything, especially the textures for character because if those characters are used in a different scene, then the whole texture will be loaded, even the pieces that aren't used.

7) When making a new script, always remove that Update function if it won't be used. If it's left there in the script, then the engine will still go in the loop every frame to see what it should do in it. It won't skip a function just because it's empty.

8) Comparing Tags. gameObject.CompareTag("thing") is faster than gameObject.tag=="thing".
So if trying to see if this is the right tag, use CompareTag. It is a native Unity function, compiles to fewer calls, it has less of an overhead... long story short, it uses less stuff and things add up.

9) Pool objects. It's really tempting to simply have a call that creates/spawns an enemy from a script. You just write it and when the game is about to use the enemy, spawn it. Well... that introduces hiccups when the entity is spawned, especially if there are alot of stuff going on with it. And if you have lots spawning; as we said already - things add up. Have a pool of enemies ready, just disabled or hidden out of sight, and when needed teleport the enemy where it's needed and have a boolean for that enemy that he is awake. When destroyed/killed, simply hide them again and set the boolean that they are free to be used again later on. This is really especially useful for example when dealing with waves of enemy ships. When they blow up, don't Destroy() the object, simply hide them.

10) Try to use Coroutines instead of Update functions in scripts. As we said in #7, Update is always checked even if it won't do anything. One of the first ways people just starting unity will use to try and control objects, is Update. At first, my self included at first, people will put a boolean in an IF check, and if true the object will do something. That hogs the main execution thread of the project. So use Coroutines instead. What are Coroutines? They are small routines that can be spun off into their own thing, running along the main thread, but unlike Update, they don't stay there looping and never letting the main thread continue. Coroutines can be called when needed, paused and delayed and when done they stop and go away. Useful for timers and controlling stuff!

Thursday, May 3, 2018

Previously unseen stuff - digital paintings

These are unused drawings done in Photoshop, for an older project that weren't used in the end.
But I'm still proud of them :P




Thursday, April 12, 2018

Spheres and UVs.

Balls. I'm not too fond of them when it comes to UV mapping one. Ironic, since the two games I made so far have nothing but balls. Spheres... I mean spheres.

Now those not in 3D graphics might wonder what UV mapping is. You see in 3D graphics you have the object represented in points that connect with each other in a certain hierarchy to form triangles, and those make the mesh. Think of it as a game of connecting the dots only in 3D space and that will give you a wireframe. Then you'd need a canvas to drape that wireframe and give it color. The traditional way of doing things is to make your mesh (your object) and then "unwrap" it, which is to take the mesh and open it up and flatten it into a 2D image to make it easy to paint on it. There are many ways of unwrapping a mesh and i'm sure that many have seen how a face mesh is unwrapped to its UV map. The easiest object to unwrap is a flat plane as that one is pretty much already unwrapped. But spheres... If you want to do some detail work on their surface you'll need to think of where you want to focus and unwrap accordingly. One would need to think of where the bulk of the detail is going to be and decide on the way to unwrap it, as depending on the way you unwrap a sphere, you might get different kinds of artifacts or stretch marks.

Default UV unwrap, next to its sphere mesh. If you noticed at the top and bottom of the right side, (the unwrap) you'll notice that the edges end up looking like a saw-blade. It's really easy to have details looking fine at the red zone, but if you try to add detail to the blue area, it will look as if it has stuff cut off. That's because you'll have pixels of your texture be unassigned to actual polygons. There IS a way to have the sphere look better but I have yet to see a default sphere from a modeling program look good on its poles. And now with VR and skyboxes in computer graphics, it gets more and more important to pay attention.
























If you click on the image above to open the full sized one, take a look at the center of the circles.
The image is from a game that was unfortunately shut down while still in beta and it shows artifacts in the center of the skydome. What you are looking at is me pointing the camera way up to look at the "sky", while waiting for the other players to get ready and start the match. The skydome is a sphere and while the rest looks fine, the last bit where the sphere ends up in the pointy bits looks collapsed. That happens when the pointy bits all connect to a single point and sort of pull the texture along.

Sure there is an "auto" button, but that one almost never gives you the results you might want, at least not with me... It could be a starting point for other kinds of meshes that you would then edit to bring up to snuff.

The way I ended up making my UV map was to make a custom unwrap, by actually projecting a flat plane towards the poles from the top, and then put the skirt that ends up being stretched to its own place. I thought of doing that as i wanted the poles to be easily texture-able.

I was also able to pack different looks for the ball into the same texture file, just to have everything in the same file. In hindsight it would have been nicer if i would have 4 textures in half the file size and load the one needed instead of having 1 big texture file loaded in memory and only use a quarter of it.



I really, REALLY wanted to make texture atlases for everything. Even when it wasn't needed...

The poles are both projected on a flat plane, leaving them with an area that can be easily textured. Top and bottom of the ball are reflected and placed on the same area in the UV map, with the waist being cut and projected on that yellow strip on its own.

I promise, the next time I need a sphere, I'll just either use a gradient from top to bottom, or just place a single color and skip texture making on the whole.

Sunday, December 31, 2017

In anticipation of 2018

To be honest, my 2018 is actually looking to be a nice one, but you know 
what they say about plans...

Have a great 2018 people, lets just try to make 2018 a good year and try not
to blame it for all the dumb stuff we'll cause throughout the year :P...

Tuesday, October 31, 2017

Know your self. - VR app idea.

We know our selves by what others say about us mostly. What you are able to see immediately are your hands and feet. Even your face, you are seeing that flipped over if you see it through a mirror, and photos don't convey much about your physicality most of the time because you can't see your self walking; you can't understand your own stride.

We could use tech that's readily available today though to sort of fix that. With the use of a 3D depth camera we can both capture our bodies and even animate them with motion capture. And i'm not talking about the expensive motion capture used in movies. We can use a €200 depth camera along with a €80-€100 3D tracking application. For the mesh we can use one of various free depth-to-3D software with said scanner, or use photogrametry. (You take a crapload of photos of your subject in a sphere arrangement, only looking inwards instead of away from the center of the sphere, then feed the photos to a software that will generate the 3D object along with the right colors.)

Then wear your VR helmet and walk side by side with your self, or stand back and actually watch how you move about . Of course you'll need to know how to use a game engine like Unity or Unreal, but heck, everything is there. All the tools needed are readily available.

"Why don't you do it then?"
I would, but i'm in the middle of something else. Shouldn't take more than a month even if things go south at some point :P. Any takers? A uni or something?

Saturday, September 30, 2017

Point and click games -The way you interact should make sense.

Most people my age (30s+) that played a lot of games on their PCs, should know about point and click games and their moon logic puzzles. And on top of that, you had those interaction controls that had 3 different action buttons that could be combined in a single one, or had some actions that could have been done in different ways and would in-fact still make sense.

I'm not talking about using a fish that you found at the very start of the game on a robot that is waiting at the very end of the game, or for waiting the guy to go to the toilet and get wrecked by an octopus so that you can get his belt... (If anyone gets the references, you get a high five.)

I'm talking about having a walk command, while the game could simply take use the mouse pointer to where you wanted to walk, and even if you did click on an interactable object, simply walk to the closest point. Or if you had a fridge for example and had an "Open", "Close" and "Interact" commands, the open and close commands (while redundant) could do what they were intended to do, but the "interact" one should work as well; open the door if it's closed, and close it if it's open.

Same with inventory management. In almost all of point and click games you would eventually go to a point where you had to find a couple of objects and combine them to do something else. And in most games I've played of that kind (dare I say all?) the player would have to get both objects and then combine them in the inventory system. Why couldn't I just pick up one part of the object, go close to the second part that could be on a table and then simply "use" the first item directly on the object that is just sitting there? This issue is still present in some form in today's games, latest example I've personally seen being FF14. To give something to an NPC, I had to initiate dialog, and the game would then give me a small on-screen box to place the item in it, either by dragging the item from my inventory to the NPC's inventory, or selecting "give". Why couldn't I just drag the item from my inventory onto the NPC and then program the NPC to simply accept the item and respond with a "Thank you!" kind of a reply? (I'm not talking about point and click games where you have to solve a puzzle by using an item on a character, but on RPG games where characters usually want some items.) Screenspace to world space conversions can be done, so the game can indeed know if you are pointing at something. That's how mouse pointers work in 3D games and applications. (I have to clarify though, that if I remember correctly, I have seen a couple of games that dragging the item from the inventory on the character would give them the item, but as far as i could tell that is still not the norm.)

"You are splitting hairs dude". Well... you may have the best software out there in terms of what it can do, but if it frustrates users with the controls, or your users keep trying to do things differently, then perhaps the controls are not as intuitive as the designer may think and might need tweaking. It's why most 3D programs or photo editing/design packages ended up having similar controls. It goes back to the "you are not your clients" argument. It's only natural that the designer won't have any serious issues with their own interface, but any issues will come up when the client tests it. Case in point, the first pilots that tested the very first F-16 models. Supposedly the new flight system had a control stick that didn't move physically, but instead registered pressure along its axis depending on how the pilot was acting on it. You see the plane was using a cutting edge technology of fly by wire, which means that the pilot didn't actually control the plane's control surfaces but instead was sending information to a computer and the computer was keeping the plane in the air. The issue was that the pilots couldn't tell how much pressure they were exerting on the stick, the engineers at General Dynamics hadn't thought of that or didn't think that it would be an issue. It was the pilots that came back and said that the feeling needs to change as they couldn't tell how much force they were applying, which that would affect their flying. The solution was to add some leeway to the flight stick to move around.

Tuesday, September 12, 2017

Random Stuff (Pup)

This little guy is just a month and a half old, with the two snaps taken just a bit over a week apart, and the left most snap wasn't even when he was at its tiniest.

So far he's the cutest poop machine.
The poop. God damn the poop. And the pee! GOD!
.
.
.
.
I'm petitioning for putting you in diapers dude...





In other news, it's video games day today. So back to coding stuff.

Sunday, August 6, 2017

Feathered Journeys (mobile app)

Released a new mobile app (for iOS and Android) almost a week ago, for a non-profit organization that's for protecting birds and their environment.
The app has a trivia game revolving around the difficulties that birds may encounter when migrating, a compact encyclopedia about a number of birds encountered in Cyprus and the capability for the user to report the location of an illegal bird trap if encountered on the island.

iOS App store.
Android Play store.

Tuesday, July 4, 2017

6D Mark II thoughts.

My camera feels as if it's on its last ... clicks. So i was expecting to see how the new 6D Mark II would be when it came out. And it does look like a decent camera... except for the Auto focus system. Don't care about the 4K video not being a feature. Or that it doesn't have a CF slot or a headphone jack. That's for the upper class models.
But GOD DAMMIT Canon! Screwing up the AF system? The thing that allows us to focus when taking photos?

The autofocus system is supposed to be related to the one from the 80D model. But that camera is an APS-C, meaning it has a smaller sensor. If you take that system and put it on a full frame camera then half the sensor won't be covered, and since the autofocus points are in the center, that means that the sensor's edges aren't covered.

That isn't a big deal in every day shooting where you'll just aim with the center point and snap, but if you want to compose a moving subject to be at the edge then it will make it really hard.
This is compromising a dSLR camera's main job. To focus and compose a scene.

Wednesday, June 7, 2017

2:50 am

The night is actually really nice and quiet, a nice calming breeze is coming through the window... is that jasmine?

And then there's is just one thing that bothers me. If there is someone at the end that would judge everything I'd like to just answer me one thing. Just one thing.

Why the f@ck are there mosquitoes!? WHY! I get roaches. I loath them but i get why they are here! 
They eat decaying matter and release the nitrogen back into the soil for the plants. But what do the buzzing devils do?! Other than transmit diseases and piss people off in the night. Food for big critters? You have other bugs and larva for that, just make them eat those! :P

My ear hurts from all the slapping.

Sunday, June 4, 2017

Flashing and curtains. (I'm talking about flash and the sensor curtains of your dSLR...)

That flash. I'm talking about that thing over there to the right. The external flash that you hook up to your dSLR.
Many people think that you just strap it on and then the camera will take care of the rest.
That's true up to a point. The whole deal with flash is to allow you to manipulate light, not just make dark things brighter. It can help you with motion, it can make bright walls even brighter to allow you for some silhouette shots, make things appear warmer and softer or colder and harsher.

It can also change the direction of things. What do i mean by that? Most of us have seen those images of things falling into water, or water droplets in fashion shots. You know, the ones where there is a model in front of a dark background and lots of water raining down. Many of us amateur photographers just point the flash and fire it. Don't do that. I've seen posts in photography forums of water shots with a slow shutter speed (to get that water movement) and when someone says "Your rain looks as if it's going upwards" they reply with "that's because of the flash."

NO. It is NOT because a flash was used and "that's how things work".
It's the settings used on the flash unit.

There is a certain trait of the way SLR cameras work and that is (are) the curtains. They are your shutter, they are what is being affected by your "shutter speed" setting, and they really are curtains. Or rather flaps nowadays that cover the sensor. (Click here for an awesome slow mo video on shutter movement from The Slow Mo Guys on YouTube™.)
What they do is that they change the duration that light actually hits the sensor and exposes the scene. How they work is by first dropping the first part which lets light come in and hit the sensor and after some time, the second one drops covering it back up. Then they rewind back up to the top and re-arm themselves for the next shot. The defaults on a flash is to fire up when the first curtain drops (which is fine if nothing is moving). By the time the second curtain drops to cover the sensor (or film, all SLRs work the same) the flash is all done. In fact it's done way before the curtain drops.

1st Curtain
--------------
So what does that mean and what does it have to do with movement?
Everything. The sequence of events is as follows: 1) 1st Curtain drops, exposure begins. 2) Flash fires and instantly fills everything with bright light. 3) Sensor is still fully exposed taking in ambient light, flash stopped firing light. 4) 2nd Curtain drops to cover the sensor.
So, the the sensor took in the majority of light at the very beginning because of the flash and after the flash was done, it was still taking in ambient light.
Imagine a water droplet coming down. It reflected lots of light at the very beginning from the flash and when the flash was done it reflected back the less intensive ambient light. That is what makes the ghosting effect, and because the majority of light reflected back was at the very beginning, the brightest and sharpest imprint of the image is when the subject falling was at the very top position; when the flash fired and then the ambient light subsequently left a fading-out trail as the droplet keeps falling down. And our brain interprets that as moving upwards because of persistence of vision. The same thing that when you move something fast right to left, you see the object at the far left with a tail behind it.

If the flash unit used does not have any controls on it (as is the case with some really small units) then the camera can change those settings through a dedicated flash menu.

And yes, that is my oooold Canon 450D that is missing an eyepiece, the rubber is falling out, it has been drenched in sea water, rain, beer, coffee and tea.

The image shows the settings for the external flash, but they are still present for the pop out flash as well.


2nd Curtain
---------------
All anyone has to do on the flash is to set it to fire at the 2nd Curtain. That's it. The camera will trigger the flash just moments before releasing the 2nd Curtain to cover up the sensor and in doing so ensures that the majority of light hits the subject at the end, and thus reverting the motion of the moving objects to what our brain is expecting.

The sequence of events now changes to: 1) 1st Curtain drops starting the exposure. 2) Ambient light comes in, no flash. Moving objects reflect only the softer ambient light. 3) Flash fires, moving objects get a burst of bright light for an instant and then immediately after ... 4) 2nd Curtain drops, ending exposure.

This is not something that is only available in pro equipment. They are normal functions of consumer grade SLR cameras and external flashes. (Note: With Canon cameras you can't set 2nd Curtain if you are in optical wireless mode. Cheap RF wireless triggers or studio strobes can be used, but that's a story for another time. If you can go wireless then you probably don't need lessons on what the 2nd Curtain is.)
















The above (shitty) example shows the difference with 1st and 2nd curtain. In both instances the fan is spinning counter-clockwise. But notice the difference in the ghosting/blurring between the two images. Sure, most people won't care about the direction a fan is spinning as long as it's spinning, but this is just to show the difference. 1st Curtain of course can be used creatively. If for example someone wants to make someone flying upwards with motion blur, then they can have the person fall downwards and shoot with the flash set to 1st Curtain. So it'll be like those water droplets we discussed previously, where the flash would freeze the subject at the top of their motion and then ambient light would create motion blur going downwards.

Tuesday, February 14, 2017

90s treasure trove.

This stack here is 20 years old. So I thought that i should digitize them before the tapes goe really bad because ... you know; they are not professionally recorded on Chrome or Type 4 metal tapes with Dolby NR, rather on cheap Type I ones, 'cause I didn't know any better. That one on the top is probably the only Type II tape in there. (At least i think it's a type II? :P)

Yeah I could do better but there's something satisfying in slapping an old cassette in the player and hitting "►" (To the young'ings, the arrow in Play buttons simply shows the direction of the tape. Yet, like the venerable Floppy ~ that's the "save" icon in many applications... ~ it stuck around even to devices or applications that aren't using any type of physical media.)
Oh and in a couple of these cassettes you may even hear a couple of stations' jingle.
(Man there's everything in there. From greek comedy rap to jazzy sax to OST)



what i really really want... 
Yeap, That was the first thing that came up on the first tape I started digitizing...












And no. When we were kids things weren't simpler or safer. It's simply that someone else was taking all the crap for us.

Friday, January 27, 2017