Jump to content

  • Log In with Google      Sign In   
  • Create Account

Alex.SilR's Journal

Day 29 - College

Posted by , in College 07 November 2012 - - - - - - · 382 views

Posted Image

Day 28 - College

Posted by , in College 07 November 2012 - - - - - - · 423 views

Posted Image

Day 27 – [SinC] – Floor, skybox and the cube

Posted by , in General, SinC 07 November 2012 - - - - - - · 848 views

Mirrored from my blog (en, pt-br).

Today I started fixing a logic error in the winning script. The fix was simple and quick.

As I now have the mechanics working (minus the bugs that I did not find) I decided to start to refine the graph, leaving it the way I want, and leave the level design further forward.

I think a sci-fi theme fits well in the game so I started looking textures. I found a texture to the floor and found a very good program that makes space skybox, the Spacescape. Some of the examples that comes into it:

Posted Image

Posted Image

Then I started looking for the cube texture and ended up finding a very good tutorial, Creating a Sci-Fi Panel. I recommend.

Today I couldn’t finish watching, neither tomorrow. So I’ll just return on Monday.

Floor, skybox and the cube (the cube will look like, but that’s not what I did).

Posted Image

PS: Sorry for the bad english.

Day 26 – [SinC] – Internal improvements, Inverter/Remove gravity and remove forces

Posted by , in General, SinC 07 November 2012 - - - - - - · 366 views

Mirrored from my blog (en, pt-br).

Today I started refactoring the internal mechanics of winning leaving it much more flexible than it was before. Now when I do the level design will be much easier.

In the winning script I ended up using the singleton (design pattern [or !design pattern]). The singleton is basically a class that is structured in a way that can only be instantiated once. The class has a private constructor and a public get that returns a reference to the object (if not created yet it creates and then returns).

In winning script itself I added the maximum time to complete a level. If the player reaches that time he loses.

After this refactoring I created a script to remove the forces of the cubes (velocity and angular velocity) when pressed Ctrl. All cubes are affected simultaneously. This provides another strategic point, but the player has to know when to use, if he use to save a cube that will leave the level can end up affecting others who are in good trajectories.

Finally I created the script to remove and invert the gravity of the cubes. To remove the gravity the player selects the projectile corresponding and hits the cube with it, if hit again the gravity returns. To invert the gravity the process is the same. The two are independent, that is, if the player invert the gravity and then removing the gravity, and after that return to gravity it will be inverted.


PS: Sorry for the bad english.

Day 25 – [SinC] – rayCast fix, C# event and Demo

Posted by , in General, SinC 07 November 2012 - - - - - - · 381 views

Mirrored from my blog (en, pt-br).

Today I started fixing the bug of the rayCast of yesterday, it was taking in the triggers of the stands causing the crosshair misaligns up with the projectile. I added the layerMask and passed as argument to the rayCast to ignore the triggers, it was pretty easy to solve.

After that I continued the logic of winning. Now when the player put all the cubes in the stands is calculate the time, the penalty and the total time in seconds.

I’m thinking of changing the mechanics to have the maximum time to complete the level and maximum cubes that can throw out.

Another thing I added was the ability of the projectile to be destroyed after colliding with a cube or not. This increases the level of strategy, because you can use the projectile to reach more than one cube.

The most interesting thing today was the modification of internal time manager. At first that each object had to stop in time had its own variable saying if the time was stopped or not, and also had its own toggle that changed the value of this variable. Now it has a central script that has a static variable and its toggle. It also has a static event that notifies when the time toggle. To make the event I used the internal event system’s C#.

Today has a playable demo.
  • Controls
    • WASD.
    • Scroll - Velocity
    • Ctrl + Scroll - Mass.
    • Shift – Toggle time.
    • Q e E – Toggle between min and max of velocity and mass.
    • K – Toggle between the projectile be destroyed at the time of collision with the cube or not.
  • Goal
    • Place the cubes of each color in the stand matching color with the shortest time possible.
    • Penalty for cube thrown out: 0.4s.

PS1: Note1: In WebPlayer I put Screen.lockCursor = true. I don’t know why it is not working.
PS2: As I haven’t studied anything about level design this demo aims to show only the mechanics.

PS: Sorry for the bad english.

Day 24 – [SinC] – Chess look, Bug DontGoThroughThings, Trigger and rayCast.

Posted by , in General, SinC 07 November 2012 - - - - - - · 426 views

Mirrored from my blog (en, pt-br).

Today I started making a change in the look of sync, as I want to focus on the mechanics at the time I did everything a chess texture. I was pleased, because became standardized and acceptable.

Posted Image

Then I started to build a level of one of the possible modes of play. The goal will be to put cubes of each color to its respective place (call stand) with the shortest time possible. The count will be progressive with precision of hundredths of seconds.

Here comes one of the main mechanics of the game, stop time.If the player press Shift the time stops, “Freezing” all the movements of the cubes and projectiles in the scene. When the player shoot with the time stopped the projectile will be stopped and will come be to its trajectory when the time starts flowing again.

Using the stop time the player will be able to better analyze and give shots synchronized, which will make, strategy and calculation of the force of the projectile (mass x speed), be a major factor in the total time of the level. When a cube is thrown out the level time will be added to the total time as a penalty.

In this video you can see how this game mode is. (In the video doesn’t have the time yet).


Doing the logic of game winning I found two bugs that was difficult to resolve.

The first was more a lack of my attention. After putting a Trigger in the level the cubes began to move in strange ways (video below).


At the end had nothing to do with the Trigger. What happened is that sometime before I added the DontGoThroughThings in the cube for it not pass the walls of the stand, but I ended up using the same layer that the cube is (In the script DontGoThroughThings the object using the script cannot be in the same layer that it will check the collisions). And as I was only testing after I added the Trigger I was thinking that the problem was with it, it was difficult to find the real problem.

To resolve this, as an object cannot have two layers, I had to use a workaround I found on the internet. Duplicated the object, removed the Mesh Renderer and placed as a son of the duplicate. Put a different layer in the duplicate. I didn’t like this solution, but for prototype work, so I’ll leave to search for a better solution later on.

The second bug, which was easier, but it also took a while was that at certain points the gun was becoming unaligned with the projectile, it happened because of some Triggers that was inside of the stand and took them rayCast. To solve this just use layerMask and pass as argument in the rayCast that it ignores this layer. But I’ll leave it to do tomorrow.

PS: Sorry for the bad english.

Day 23 – [SinC] – DontGoThroughThings

Posted by , in General, SinC 07 November 2012 - - - - - - · 407 views

Mirrored from my blog (en, pt-br).

Today I did some things in sync:
  • Color of the mass panel changed to red.
  • Q e E keys to toggle between min and max.
  • Change projectile mass with Ctrl + Scroll.
  • Projectile gravity removed.
  • Cube created.
  • Crosshair add.
  • Align between the crosshair and the projectile.
  • Apply the script DontGoThroughThings.
Panel + Crosshair + Cube:

Posted Image

Testing the prototype when it increased the speed of the projectile I realized that it was past the cubes to the point of not collide with any cube. Actually what was happening is that as the projectile was too fast, it not collided with the cube, if you go frame by frame you can see it. I researched and found the script DontGoThroughThings that solved this problem. Just put the script on the object that will move very fast and all the other objects that you want it to collide inside a layer and pass this layer to the script.

Check out the results:
  • Without DontGoThroughThings (Online).
  • With DontGoThroughThings (Online).

PS: Sorry for the bad english.

Day 22 - [SinC] – Game Overview Document, CustomPlayer and Shoots

Posted by , in General, SinC 06 November 2012 - - - - - - · 448 views

Mirrored from my blog (en, pt-br).

On day 22 I did the GODD of the SinC, the CustomPlayer, and the gun shoot.

The first thing I did today was the GOD of Sync (Shooting Into Cubes [name that thought for now]). I will not explain how the GOD is, it is easier to see:

1. Executive

1.1. Game Type
The game will be a first person shooter puzzle.

1.2. Name
The name of the game will be for now SinC (Shooting Into Cubes).

2. Game Elements

2.1. Gameplay
The goal of the game is shooting into cubes in order to take them to certain areas. To do so the player will have a weapon capable of:

  • Change the projectile velocity.
  • Change the projectile mass.
  • Change the projectile impact.
    • Directional.
    • Blast.
    • Gravitational.
  • Remove gravitational force of the cubes.
  • Remove forces of the cubes.Invert gravitational force of the cubes.

In addition to this weapon the player will also have the ability to stop time to prepare and plot the best strategy. While stopped in time the player can shoot projectiles, which also froze and returned to their trajectory when the time flow is restored.

2.2. Game Pacing
As the mechanics of the game will be very repetitive the game will aim to be casual, where the player doesn’t need to follow stories and other elements.

2.3. Target Audience
The game will target audience of players who enjoy first person shooter and puzzle without age restrictions, because the game doesn’t contain any violence or situations that may cause discrimination.

3. Story Elements

3.1. Synopsis
Not applicable.

3.2. Setting
Not applicable.

3.3. Player role
Not applicable.

4. Interface

4.1. Perspective
First Person Shooter.

4.2. Mechanics
Basically the game will feature a main menu and one where the player will be able to choose the level you wish to play.

4.3. Control

  • Player’s movement.
    • W – Forward.
    • S – Back.
    • A – Left.
    • D – Right.
  • Camera’s movement.
    • Mouse.
  • Shoot.
    • Right mouse button.
  • Change projectile velocity.
    • Mouse scroll.
  • Change projectile mass.
    • Mouse scroll when Ctrl pressed.
  • Change the impact type.
    • Mouse scroll when the right mouse button pressed.
    • 1, 2, 3 of the keyboard.
  • Time toggle.
    • Shift.

PDF version: Download.

Where I found (it has more models): Access.

After that I found here on the notebook, the prefab of a first person controller that I had made following a tutorial of FPS (I call CustomPlayer). He has the camera movement much smoother than the Character Controller that comes by default in Unity, actually I haven’t looked too in the settings to see if it can achieve the same result.

In the videos below you can see the difference.

Character Controller


Custom Player


See for yourself:The tutorial is very good, the author explains each line of code. Start watching here.

As CustomPlayer was ready I just needed to integrate with the gun. At this point I found a problem actually is the difference of coordinates between Unity and Blender (in Unity Y is up and Z in Blender is up). As the script places the gun in the direction of the camera (the player’s eyes) and the coordinates are different, the gun stood aside. One way to solve this would be to change the script, but it would be very complicated, because I would have to keep the coordinates swapped. I researched and resolved in a way that is in Unity’s own documentation (here), place the object inside an empty object (Like the empty object is created within Unity the coordinates are equal), then any manipulation should be done through this empty object .

After I fixed the position of the gun, making the shooting script was pretty easy at the moment it is only changing the projectile speed.


Test here.

PS: Sorry for the bad english.

Day 21 – Blender, Prototype and SetTexture

Posted by , in General, SinC 06 November 2012 - - - - - - · 367 views

Mirrored from my blog (en, pt-br).

The day 21 was basically a copy of the previous day. What I had in mind to model the gun didn’t work, so I ended up spending more time than I should again. In the end I ended up not liking the result, but I’ll use it to prototype.

I thought this weekend (20 and 21) I could leave the prototype well underway, but in the end there was not much progress (there was learning, so I’m not sorry to lose this time in modeling the gun).

Posted Image


Besides modeling, I lost some time in the “panel” of the gun and with that I learned one of the most interesting things today, which was how to access the textures of a shader using the method SetTexture. SetTexture receives a string that says which texture you want to modify and texture to replace.

The hardest part was finding what is the name given to the texture I needed to modify (in the case was a Illumin Self-Illumin). After searching I ended up finding that on the site of Unity you can download the code of the shaders that comes by default in Unity, and seeing the code you can see the name used.

The code of the Illumin-Diffuse is:

[source lang="java"]Shader "Self-Illumin/Diffuse" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} _Illum ("Illumin (A)", 2D) = "white" {} _EmissionLM ("Emission (Lightmapper)", Float) = 0 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf Lambert sampler2D _MainTex; sampler2D _Illum; fixed4 _Color; struct Input { float2 uv_MainTex; float2 uv_Illum; }; void surf (Input IN, inout SurfaceOutput o) { fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); fixed4 c = tex * _Color; o.Albedo = c.rgb; o.Emission = c.rgb * tex2D(_Illum, IN.uv_Illum).a; o.Alpha = c.a; } ENDCG } FallBack "Self-Illumin/VertexLit"}[/source]
At first we can see that, in the Properties block is the names used. In my case _Illum. Then the method would be:
[source lang="java"]obj.render.material.SetTexture(“_Illum”, texture);[/source]
PS: Sorry for the bad english.

Day 20 – Blender, prototype and Qdir

Posted by , in General, SinC 06 November 2012 - - - - - - · 413 views

Mirrored from my blog (en, pt-br).

Today I spent the whole day modeling and thinking about how will be the gun of the prototype of the game that I haven’t discussed here yet. In the end I did not get to any model that satisfied me, but it was worth because I ended up practicing.

It was worth it not only for practicing in Blender, but also solve some problems that appear along the way, this is one of the best ways to learn. One problem for example, was that the way I modeled part of the gun Normals became reversed, when I imported to Unity I saw. I returned to Blender, and used Ctrl + N thinking it would solve, and not resolved. I took a look and ended up finding the option to show the Normals of faces and vertices. After that I had to manually flip using the Flip Normals.

Posted Image

I also tested some textures and I’ll probably use a brushed steel for the whole gun.

In this workflow of modeling in Blender and import into Unity I felt a delay because of the Windows explorer. I got two windows open (one with. Blend textures and [I like to leave the editable separate from Unity project structure] and another for the Unity project files) and get file transferring from one to another (although simple) often ends up consuming considerable time. At the time I used Debian and KDE one of the features that always missed when I went back to Windows was the same window split in two. I googled and found the QDir, which is very good. I recommend to anyone who used navigating between folders a lot on your workflow.

Posted Image

I know I’ve wasted too much time on the gun for a prototype and has more essential things to do, but as I liked and learned a lot today, tomorrow (as I already have in mind what I will do) I want to finish the gun.

PS: Sorry for the bad english.

January 2017 »

22 23 2425262728

Recent Entries