texts:
I was looking at the pygame.time.Clock.get_fps() method and after puting it inside of the while loop printing and checking it some times, i see that i starts to give its value after five frames (and not 10 as said in the documentation). I did put this inside the while loop (clock is the object of the pygame.time.Clock() class created inside my class):

 print "clock.tick:", self.clock.tick(self.fps)
 print "clock.get_fps", self.clock.get_fps()

and the result by having the fps=60 was:

clock.tick: 48
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 0.0
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331
clock.tick: 16
clock.get_fps 51.8134689331

As one can see the first clock.get_fps comes out after the first 5 calls, but it supposedly should calculate the average of the last 10 calls to tick(). What am i missing here? Can anyone help explain this?


texts:
How to implement soft shadows for omni directional (point) light. We use typical shadow mapping technique. Depth is rendered to texture cube and addresing is pretty simple then. Just using vector from light to fragments world position. It works perfectly. Until you want soft shadows. In our engine we use PCSS technique for spot lights. But for point light there begins troubles.

How to sample in 3D?

I developed technique when orthonormal basis is created from  a direction and upvector (0,1,0). And then multiply sampling vector (something like this (1.0,i/depthMapSize,j/depthMapSize) with this basis. But this (of course :)) looks pretty bad for vectors near (0,1,0) and (0,-1,0).

I will appreciate any help on this.


texts:
I have finally completed my game and ready to upload my game to the App store, but my build size is too large.

I have checked log statement and it is roughly 13.3 mb but when i build my game and test on iOS device it is 80.0 mb.

Also

Scripting Backend is 'Mono2x'

Stripping Level is 'use micro mscorlib'

Script Call Optimisation is 'Fast but no Exception'

My Game size must be around 15 to 20 mb why it is too large?

What i am missing?


texts: What is the best practice for handling touch events on different GameObjects in Unity2D?

texts:
First of all I want to describe what I have in my scene.
1. Joystick.
2. Main character that has link to joystick and handles touch events from joystick.
2. Buttons.
3. Other GameObjects that must handle touch events.

But that's not all. When player is touching any part of screen (except of the above objects) main character must start fighting. The problem is in that I cant correctly handle all touch events on these game objects. When the player is touching to the joystick the main character starts moving but before this he is performing a single fight action. Can anyone give me some ideas how to correctly handle touch events on different gameobjects? Perhaps my question is confusing, I am sorry for this.


texts: To extract Grabpass image as texture2d via script

texts:
We applied it to the plane object using Grabpass.
I want to import the image shown in plane through script.
I want to make the imported image in texture2d format.
Is there a way?
Below is the relevant code.


texts: Perspective projection with 90 degrees between X-Y axis?

texts:
I'm trying to create a game that mimics Tibia's projection style:

(source: mmoginfo.com)
,

As you can see, a 3d point is mapped to 2d like this:

So I've downloaded Three.JS and a lib to create a Orthographic Camera. But I'm getting this:

Where, as you can see, the projection is like this:

Which is not what I want. What can I do to get the desired projection?

NOTE: I noticed the Orthographic Camera object is just a regular camera with camera.projectionMatrix changed, so I guess I could create my own kind of camera object, probably finding out the right projectionMatrix, but how?


texts: What is the best way to draw outline of object using OpenGL

texts: I want to select the best way to draw outline of 3d human like object and what would be the best way to draw outline for this kind of objects. I found about stencil buffer based methods, geometric shader based methods and toon shader based methods is one if this is good if so which method. or is there any other best way to draw a outline.


texts: Octahedral impostors, Octahedral mapping

texts:
I'm facing some issues understanding this article about octahedral impostors.

More specifically I quite don't understand how one can map the hemi-octahedron (subdivided) vertices to texture coordinates.

Quote from the article :

  "For those not familiar with octahedra, they are a convenient way to convert between 2D and 3D space, or vice versa."

This two images help visualize the transformation:

Here we can see an animated transition from a tesselated quad mesh to a hemisphere or a full sphere.

Here we see a view of the model to be imitated associated with each vertex of the mesh, giving coverage of viewpoints around the hemisphere: side views around the perimeter of the square, and top-down views near the center.

I don't understand the math used to perform this mapping from the square domain of the quad to the hemisphere or sphere of directions around the model.

This article also says that we can easily map 3D to 2D uvs, without explaining how or why. I found a few research papers about octahedron and normals compression but it is quite a different problem and honestly I didn't really get the grasp of them.

Could someone explain to me how to map a vertex expressed in 3D (ie impostor camera position) from the octahedron to a plain 2D texture?

The goal is to be able to cast a ray to the octahedron and map the hit point coordinates to 2D uvs, or find the nearest vertex and render the texture associated with it.


texts: Player position on second player connection

texts:
I'm having some trouble trying to run my game for the multiplayer part. I'm creating a 2D game.
I have followed this tutorial : http://www.paladinstudios.com/2013/07/10/how-to-create-an-online-multiplayer-game-with-unity/ and I've implemented it. As the tutorial says, I have a network view pointing to a script, containing my OnSerializingNetworkView and his interpolation and predilection stuff. It's working very fine, the movement is fluid and it's very good.
The problem is when a second player join the game and my first player have already moved, since I'm instantiating the player using Network.Instantiate(prefab, Vector2.zero, ...) the player spawn in the middle of the map and then slowly move to his normal position. I've tried other things such as not using a script but putting the transform in the network view, when the second player spawn, the first one is at the correct position but the mouvements aren't the same and aren't that fluid.

Anyone have any idea on how to deal with this problem ?

Thanks!


texts: Using fixed timestep and interpolating states makes physics fall behind one frame. Does that affect responsiveness?

texts:
The title says it all, but let me build more into the question:

I suppose everyone by now knows the Fix Your Timestep article, and its proposal to free your physics engine steps from your rendering steps. Which you can accomplish by accumulating time generated by the renderer and consuming it in fixed step sizes.

The interesting part is that Glenn Fiedler tells you to interpolate the previous and the current frame, which lead me to the following question:

Doing such will make the rendering lag one frame behind the physics. Won't that affect my input responsiveness? Since I'll take one more frame to see the results of my actions.

One may be inclined to say that one frame doesn't make that much of a difference, but then, these three articles of Mick West, one of the founders of Activision and former programmer of "Tony Hawk's Pro Skater" series says otherwise:

Pushing Buttons
Measuring Responsiveness in Games
Programming Responsiveness

So again, the question: Interpolating the previous and current frame, will make me lag one frame behind. Will that hurt my input responsiveness?


texts: How do I implement movement in a WPF Adventure game?

texts:
I'm working on making a short WPF adventure game.  The only major hurdle I have right now is how to animate objects on the screen correctly.  I've experimented with DoubleAnimation and ThicknessAnimation both enable movement of the character, but the speed is a bit erratic. The objects I'm trying to move around are labels in a grid, I'm checking the mouse's position in terms of the canvas I have the grid in.

Does anyone have any suggestions for coding the movement, while still allowing mouse clicks to pick up items when needed? It would be nice if I could continue using the Visual Studio GUI Editor.  By the way, I'm fine with scrapping labels in a grid for a more ideal object to manipulate.

Here's my movement code:

ThicknessAnimation ta = new ThicknessAnimation();

The event handling movement:

private void Hansel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
     ta.FillBehavior = FillBehavior.HoldEnd;
     ta.From = Hansel.Margin;

      double newX = Mouse.GetPosition(PlayArea).X;
      double newY = Mouse.GetPosition(PlayArea).Y;
      if (newX < Convert.ToDouble(Hansel.Margin.Left))
      {
           //newX = -1 * newX;
           ta.To = new Thickness(0, newY, newX, 0);

      }
      else if (newY < Convert.ToDouble(Hansel.Margin.Top))
      {
            newY = -1 * newY;
      }
      else
      {
            ta.To = new Thickness(newX, newY, 0, 0);
      }
      ta.Duration = new Duration(TimeSpan.FromSeconds(2));
      Hansel.BeginAnimation(Grid.MarginProperty, ta);
}

Screenshot with annotations:

Screenshot with example movement:


texts: Screen space decals, converting world to decal space

texts:
I'm trying to do screen space deferred decals following the presentation made by Pope Kim about SSDs in WH40K: Space Marine (link). I've gotten to the point where I can render a decal if the bounding box is placed at the world space origin (0, 0, 0). The moment I move the bounding volume the decal is still trying to render at the world space origin and can be seen if you look "through" the bounding volume. The red planes in the picture are the bounding volume rendered for reference, the circular patch is the decal.

Picture showing a decal rendered correctly at world space origin

Picture showing a decal clipped when rendered offset from world space origin

Decal as seen "through" offset bounding volume.

My code is fairly similar to that off Kim, with minor differences accounting for the D3D to OpenGL transition.

Vertex shader:

#version 430

layout (shared) uniform PerFrameBlock
{
    mat4 gView;
    mat4 gProjection;
};

uniform mat4 modelMatrix;
uniform vec3 decalSize;

layout ( location = 0 ) in vec4 positionIN;
layout ( location = 1 ) in vec4 normalIN;
layout ( location = 2 ) in vec4 tangentIN;
layout ( location = 3 ) in ivec4 boneIndices;
layout ( location = 4 ) in vec4 boneWeights;
layout ( location = 5 ) in vec2 uvIN;

out vec4 posFS;
out vec4 posW;
out vec2 uvFS;

void main()
{
    posW = modelMatrix * vec4(positionIN.xyz * 1, positionIN.w);
    //Move position to clip space
    posFS = gProjection * gView * posW;
    uvFS = uvIN;
    gl_Position = posFS;
}

Fragment shader:

#version 430
#extension GL_ARB_texture_rectangle : enable

in vec4 posFS;
in vec4 posW;
in vec2 uvFS;

uniform sampler2D gNormalDepth;
uniform sampler2D gDiffuse;

uniform float gGamma;

uniform mat4 invProjView;
uniform mat4 invModelMatrix;

vec4 reconstruct_pos(float z, vec2 uv_f)
{
    vec4 sPos = vec4(uv_f * 2.0 - 1.0, z, 1.0);
    sPos = invProjView * sPos;
    return vec4((sPos.xyz / sPos.w ), sPos.w);
}

layout ( location = 1 ) out vec4 diffuseRT;
layout ( location = 2 ) out vec4 specularRT;
layout ( location = 3 ) out vec4 glowMatIDRT;

void main()
{
    vec2 screenPosition = posFS.xy / posFS.w;

    vec2 depthUV = screenPosition * 0.5f + 0.5f;
    depthUV += vec2(0.5f / 1280.0f, 0.5f / 720.0f); //half pixel offset
    float depth = texture2D(gNormalDepth, depthUV).w;

    vec4 worldPos = reconstruct_pos(depth, depthUV);
    vec4 localPos = invModelMatrix * worldPos;

    float dist = 0.5f - abs(localPos.y);
    float dist2 = 0.5f - abs(localPos.x);

    if (dist > 0.0f && dist2 > 0)
    {
        vec2 uv = vec2(localPos.x, localPos.y) + 0.5f;
        vec4 diffuseColor = texture2D(gDiffuse, uv);
        diffuseRT = diffuseColor;
    }
    else
        diffuseRT = vec4(1.0f, 0, 0, 1);
}

I think my problem stems from the conversion from world space to decal space using the inverse model matrix. The model matrix is build by the following code:

        glm::quat rot;
glm::mat4 rotationMatrix;
glm::mat4 translationMatrix;
glm::mat4 scaleMatrix;

        rotationMatrix = glm::toMat4(rotation);
        translationMatrix = glm::translate(glm::mat4(1.0f), position);
        scaleMatrix = glm::scale(scaleX, scaleY, scaleZ);

       modelMatrix = translationMatrix * rotationMatrix * scaleMatrix;

To get the inverse I just use the following:

glm::inverse(modelMatrix)

What I'm wondering is if inverting the model matrix like this actually correct or am I doing something with it which would cause this kind of behaviour? I've tried offsetting the calculated local space position in the shader with no luck (probably because the distance gets borked) and I'm starting to run out of ideas.

Any help is much appreciated!


texts: There are three cameras in my scene - Camera1, Camera2, Camera3. I want to have Camera1 as the only current camera. But whenever I remove the "current" tick from Camera2, Camera3 becomes current, and vice versa. No matter what ticks I tick and in what order, I cannot reach the desired state - Camera1 as current, Camera2, and Camera3 as not current. What's going on?


texts: Entity Component System, How to decouple components need for entity as parameter?

texts:
I use Artemis entity system framework, C# port. I have problem with figuring out a good way to handle items and using them.

Game is AI driven mostly, so it's not the player that is interacting, but AI. AI is basically Entity with AIBehaviorComponent that is ran by AISystem. AI has helper functions that allows it to find all items (ie. Entities with InteractiveComponent) and then it can pathfind to it and use that item. AI is using BehaviorTree that is stored in it's component.

I have InteractiveComponentthat allows player and AI to Use entity. I have this thing working, but it looks a bit dirty solution. Use method is interface that is implemented by Item object that is tied to that component. This way i can have item made with:

new InteractiveComponent(new AwesomeItem());

Calling Use requires me to:

Get entity ref
Find component 'InteractiveComponent`
interactiveComponent.use(me)

me is (this) Entity. The AI entity that is calling the use. I am passing entity to Use method, because using something can alter the entity. It could add component to it, check if it has certain component and then modify the data or remove components, it could even remove the entity.

So, I'm bit lost here. This works, so it's "ok" i guess, but it looks very dirty. I have not found a way to allow somekind of InteractiveSystem to take care of item using without adding huge complexity issues ( Those arise quickly when you try to force Entity system to do something it does not easily allow ).

So, question is:

How to decouple this so, that i don't have to pass Entity to component?

I just don't feel good about the current code but so far it's the best solution we have come up with.


texts: Blender 2.5 - Using a Bezier Circle to set Bezier Curve as the Bevel Object

texts:
I'm trying to follow the tutorial found here.

Around 5:40 (ish) in the video, he adds a Bezier Circle. He then adds the existing Bezier Curve as the Bevel Object on the Circle. This makes the Curve go around the circle creating the 3D chess piece.

I'm trying to do the exact same thing, but it's not working. I am using Blender 2.5 however too. When I set my curve to be the Bevel Object of the Circle, my Bezier Circle is just becoming a larger gray disc of goo. I was expecting it to be a 3D chess pawn.

You can see a screenshot of what mine looks like:

Before Bevel Object is Placed

After Bevel Object is Placed

For the record, the name of my Bezier Curve is "BezierCurve" and the name of my Bezier Circle is "BezierCircle".

Thanks in advance,
Andy

UPDATE 1

I just added a plan unchanged Bezier Curve and unchanged Bezier Circle and performed the same steps and it does work. Something must be wrong with my Bezier Curve in that it isn't being projected correctly around the Circle.

UPDATE 2

Just realized that when I set the Bezier Curve handles to "Automatic" using the V shortcut (only for Blender 2.5), then my Circle no longer imitates the 3D curve. I need Automatic I think in order for the Bezier Curve to not be wavy. With Automatic, it does a slight curve directly from point to point. Thoughts?


texts: How do I modify textures in SDL with direct pixel access?

texts:
I'm trying to use SDL_LockTexture and SDL_UnlockTexture for directly editing pixels in a texture. I'm using SDL 2.0. Setting the pixel value using the following code doesn't modify the texture:

void *pixels;
int pitch;

SDL_LockTexture(mytexture, NULL, &pixels, &pitch);

// Set pixel 100,100 to blue
((uint32_t *)pixels)[100 * 100] = 255;

SDL_UnlockTexture(mytexture);


texts: How to await async operations / coroutines?

texts:
I'm looking for a generic / reusable way to wait for coroutines and asynchronous operations to finish in Unity 5, similiar to C#5's await keyword.

The simplest way I can think of is something like this:

 public class SomeUtility {
     public bool IsDoingSomething { get; private set; }

     public IEnumerator DoSomethingAsync() {
         IsDoingSomething = true;
         yield return new WaitForSeconds(2);
         IsDoingSomething = false;
     }
 }

and then in another coroutine:

 while(!someUtilityInstance.IsDoingSomething)
     yield return null;

However this is not very nice because it clutters the code with while statements, is not reusable (needs instances and dedicated classes even for simple utility functions!) and a lot of singleton or static stuff where it's not even needed.

The closest I found is using Unity's AsyncOperation. This here works very nicely:

public static IEnumerator Await(this AsyncOperation operation) {
    while(!operation.isDone)
        yield return operation;
}

yield return SceneManager.LoadLevelAsync("blaaaah").Await();

However.. the problem is: How to create an AsyncOperation? A few services, for examples SceneManager are using it, but the documentation completely lacks anything about creating custom operations or wrapping existing coroutines etc.

So, is there a way to create a simple, generic and resuable "await" for custom coroutines?


texts: Tile textures on 3D models. HLSL shader code maybe?

texts:
I'm making a game in C# with XNA. I'm now applying textures to models. However if I change the scale of the model, the texture stretches with it. How can I make the texture tile over the model instead of stretching? I'm using UV mapping to load the texture onto the model. This only has to work for a cube so I'm not worried about UV mapping issues. I have just been using the basic effect class in XNA because I haven't needed anything more yet.

Is there a way to set the texture to draw in a tiled manor?

Can this be done in C#? Maybe by changing the GraphicsDevice.SamplerStates?

Can this maybe be done with a HLSL shader? I know very little about HLSL.

This is the first 3D game I'm making so everything is very new to me. Please keep that in mind when answering. Thanks in advance.

EDIT:

So I did some testing with the GraphicsDevice.SamplerStates
Here is my UV map:

Here is my texture:

Here are the results:

                GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;

                GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

                GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicWrap;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Point;
                samState.AddressU = TextureAddressMode.Wrap;
                samState.AddressV = TextureAddressMode.Wrap;
                samState.AddressW = TextureAddressMode.Wrap;
                GraphicsDevice.SamplerStates[0] = samState;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Point;
                samState.AddressU = TextureAddressMode.Mirror;
                samState.AddressV = TextureAddressMode.Mirror;
                samState.AddressW = TextureAddressMode.Mirror;
                GraphicsDevice.SamplerStates[0] = samState;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Linear;
                samState.AddressU = TextureAddressMode.Wrap;
                samState.AddressV = TextureAddressMode.Wrap;
                samState.AddressW = TextureAddressMode.Wrap;
                GraphicsDevice.SamplerStates[0] = samState;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Linear;
                samState.AddressU = TextureAddressMode.Mirror;
                samState.AddressV = TextureAddressMode.Mirror;
                samState.AddressW = TextureAddressMode.Mirror;
                GraphicsDevice.SamplerStates[0] = samState;

None of them seem to have tiled the image. So does that mean I need to use the HLSL shader as well?

EDIT:
This is what I'm trying to achieve:

OR


texts: IDE & Debugging of Official SDK for wii and ps3?

texts:
I remember hearing that wii and the ds uses CodeWarrior as their IDE. I know xbox uses visual studios but i have no idea what ps3 uses.

What IDE do ps3 developers use and how do they debug? How do wii programmers debug? I always heard they use GDB but is that built into CodeWarrior or is that a separate application?


texts: 2D isometric: screen to tile coordinates

texts:
I'm writing an isometric 2D game and I'm having difficulty figuring precisely on which tile the cursor is. Here's a drawing:

where xs and ys are screen coordinates (pixels), xt and yt are tile coordinates, W and H are tile width and tile height in pixels, respectively. My notation for coordinates is (y, x) which may be confusing, sorry about that.

The best I could figure out so far is this:

int xtemp = xs / (W / 2);
int ytemp = ys / (H / 2);
int xt = (xs - ys) / 2;
int yt = ytemp + xt;

This seems almost correct but is giving me a very imprecise result, making it hard to select certain tiles, or sometimes it selects a tile next to the one I'm trying to click on. I don't understand why and I'd like if someone could help me understand the logic behind this.

Thanks!


texts: Transforming quaternion between coordinate systems

texts:
Working in DirectX (with DirectXMath objects): If I have the rotation of an object relative to some coordinate space as quaternion Q, and I have a transformation matrix tx from that coordinate space to world space, how do I find the rotation of my object in world space?

My thinking, which has proven inaccurate, was:
Use XMMatrixDecompose on tx to get the orientation that is the rotation difference between world space and my local coordinate space (qLocalToWorld), invert it to get the rotation of the local coordinate system relative to the world (qWorldToLocal) and combine it with my local rotation Q.

XMVECTOR scale, qLocalToWorld, translation;
XMMatrixDecompose(&scale, &qLocalToWorld, &translation, tx);
auto qWorldToLocal = XMQuaternionInverse(qLocalToWorld);
auto worldOrientation = q * qWorldToLocal;

I figured for e.g. that if the local coordinate system was rotated 90 degrees with respect to the world, and my object was 5 degrees with respect to local, this would yield the 90 + 5 = 95 in world space. But I was wrong :(

I'd appreciate help in understanding the right way to do this. Thanks in advance!


texts: What are some legal concerns I should have before consulting a web developer on an idea of mine

texts:
I have an idea for a web application but I am a little bit hesitant to consult a company due to fears of having my idea stolen.

What are some preliminary tasks I should set myself before actually consulting a company representative?

My main concerns are strictly legal-related. What measures should I take to make sure that the company does not steal any of my ideas with regards to the application's features, design, name, etc.


texts:
This isn't so much a "give me teh codez" as it is a request for the "right" steps to go through.

I want to implement FXAA in XNA, but I'm a relative newb to the graphics side of game dev, so I'm not sure what the most efficient way to do this would be.

My first hunch is to render the scene into a texture, and then render that texture on a rectangle, with the FXAA code in a pixel shader.

However, I would actually be surprised if there was no more efficient way to do it.


texts: Running both the server and the client within the same process

texts:
Question

I have just started working with Lidgren and networking for the first time, and I've come to the realisation that it is possible to run both the server and the client within the same process.

Is this practice discouraged for any reason?

Context

The reason I'm asking is because I theorized that this concept might allow me to treat both singleplayer and multiplayer modes as one and the same, which would be very helpful.

Following my line of thought, this is the distribution I had in mind:

Singleplayer - 1 server + 1 client in the same process. How fast are the communications?
Multiplayer - Same as singleplayer for the host + 1 aditional client for each other player.

The execution flow I'm picturing is for clients to recieve user input and send a notification to the server. Then the server validates it, and broadcasts an action to be executed by all the clients. It shouldn't matter if there is only one client (i.e. singleplayer) or multiple clients (i.e. multiplayer).


texts: Updated Unity project from 2020.2.1f to 2021.1.7: lighting is messed up, scenes are brighter

texts:
I've updated my project from 2020.2.1f to 2021.1.7 (also tried 2020.3.8), and now my scenes are much brighter for some reason:

Any tips?
Current I use the standard pipeline I think, because the Render Pipeline Asset is set as None.
I have only one realtime directional light in the scene, and no Lighting Settings set in the Lighting window. The environment is the Default-Skybox.


texts: Unity's Android Notification system works on my Xiaomi, but on a Huawei every notification has an "Unknown" status?

texts:
When my app starts I check whether there is a notification or not

if there isn't I create one via SendNotification(...)
if there is, I check their status:

var status = CheckScheduledNotificationStatus(notificationId);
On my Xiaomi their status is Scheduled, so I update them:

SendNotificationWithExplicitID(...)

But on a Huwaei it's always Unknown, in that case I create a new:

SendNotification(...)
And replace the old ID in the PlayerPrefs.
But on the next startup it's unknown again.

Maybe I should use SendNotificationWithExplicitID(...) as well when the status is Unknown so I can keep the ID?

Here is the code:

var notification = CreateNotification(jsonWrapper.Name, fireTime, title, text);
if (PlayerPrefs.HasKey(jsonWrapper.Name))
{
    var notificationId = PlayerPrefs.GetInt(jsonWrapper.Name);
    var status = AndroidNotificationCenter.CheckScheduledNotificationStatus(notificationId);
    if (status == NotificationStatus.Scheduled)
    {
        AndroidNotificationCenter.SendNotificationWithExplicitID(notification, "default", notificationId);
        Logger.Log($"Updated a notification: {jsonWrapper.Name} at {fireTime}.");
    }
    else if (status == NotificationStatus.Unknown)
    {
        var id = AndroidNotificationCenter.SendNotification(notification, "default");
        PlayerPrefs.SetInt(jsonWrapper.Name, id);
        PlayerPrefs.Save();
        Logger.Log($"UnknownStatus | Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
    }
}
else
{
    var id = AndroidNotificationCenter.SendNotification(notification, "default");
    PlayerPrefs.SetInt(jsonWrapper.Name, id);
    PlayerPrefs.Save();
    Logger.Log($"Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
}


texts:
I'm trying to create the effect of the second picture below where there is no seam between the floor or wall. An effect that is typically used in studios by having a curved wall. This way it looks like the model is standing in an infinite space while still being able to cast a shadow on the floor for example.

There are probably different ways to create this. But how would you do it? I was thinking of a using a curved wall that starts from the floor and curves up. Then simply use a gradient texture on it. To create the curved wall I was planning to use this package that allows me to use splines directly in unity, instead of creating a curved wall in Blender and then importing it in unity for example.

I haven't bought the package yet because I would like to know if there are any better ways to create something like this. As you see here in the image below there is this gradient background effect. https://www.assetstore.unity3d.com/en/#!/content/7038


texts: Why should I choose to design a health bar rather than heart containers?

texts:
When designing any hero-based game, be it adventure, RPG, brawler, or similar, you eventually need to decide on your health system. Barring any regenerative systems with zero UI (like Call of Duty), should you use a discrete set of heart containers, Zelda-style, or a continuous health bar, like Street Fighter?

Here are some points of contention that I've been thinking about:

Hearts are easier to understand (very clear how many hits you can take)
Hearts give a better sense of accomplishment when expanding (A whole extra heart! Rather than just a slightly longer bar (or worse, no change))
Hearts grow to take up a lot of screen real-estate, while health bars can stay compact
Health bars allow for really fine control over health/damage balancing (using float rather than int)

Since I haven't been able to find any relevant game design articles on the subject, I'd really appreciate if everyone with some knowledge on the matter, or even just some insightful links would contribute, thanks!


texts: How to make bullets follow a rotating sinewave pattern

texts:
I am trying to replicate the wave gun from Super Metroid where the bullets fly along a sine wave path. The cool part is that you can shoot in 8 directions and the bullet still follows the sine as if the whole sine function is rotated. I've tried using a 2d transformation to allow shooting in every angle but I cant get it to work. Here my code so far (JSFiddle.net). If you uncomment the line "Axis.dir += .02;" in the fiddle to start the rotation you'll notice that the black box doesn't follow it's axis at all.

var canvas = document.getElementById("can"),
  ctx = canvas.getContext("2d"),
  width = canvas.width, height = canvas.height,
  Axis = { x: width / 2, y: height / 3, dir: 0, vx: 0, vy: 0, speed: 4 },
  Sine = { x: Axis.x, y: Axis.y, angle: 0 },
  loop = function() {
      var rotatedX, rotatedY;
      // Draw
      ctx.clearRect(0, 0, width, height);
      ctx.fillStyle = "#F00";
      ctx.fillRect(Axis.x, Axis.y, 5, 5);
      ctx.fillStyle = "#000";
      ctx.fillRect(Sine.x, Sine.y, 10, 10);
      // Apply speed
      Axis.vx = Math.cos(Axis.dir) * Axis.speed;
      Axis.vy = Math.sin(Axis.dir) * Axis.speed;
      Axis.x += Axis.vx;
      Axis.y += Axis.vy;
      Sine.x = Axis.x;
      Sine.y = Axis.y + (Math.sin(Sine.angle) * 30);
      // Apply rotation
      rotatedX = Sine.x * Math.cos(Axis.dir) - Sine.y * Math.sin(Axis.dir);
      rotatedY = Sine.x * Math.sin(Axis.dir) + Sine.y * Math.cos(Axis.dir);
      Sine.x = rotatedX;
      Sine.y = rotatedY;
      Sine.angle += .03;
      Axis.dir += .02;
      // Keep drawn stuff on the screen
      if (Axis.x > width && Axis.vx > 0) Axis.x = 0;
      if (Axis.x < 0 && Axis.vx < 0) Axis.x = width;
      if (Axis.y > height && Axis.vy > 0) Axis.y = 0;
      if (Axis.y < 0 && Axis.vy < 0) Axis.y = height;
      window.requestAnimationFrame(loop);
  }
loop();


texts: Firing attack and take_damage events on entity attacking?

texts:
I have an Entity class with health, armor, and damage.
I want my entities to raise some kind of take_damage and attack events whenever they attack or take damage. Here's my current implementation:

class Entity:

   """Base class for all entities."""

    def __init__(self, name, health, armor=0, damage=0):
        """Initializes a new entity."""
        self.name = name
        self.base_health = health
        self.base_armor = armor
        self.base_damage = damage
        self.events = event_dict('take_damage', 'die', 'attack', 'kill')

    def take_damage(self, damage, attacker=None):
        """Takes damage from a source."""
        final_damage = damage * (self.armor / (100 + self.armor))
        self.base_health -= final_damage
        self.events['take_damage'].fire(
            attacker=attacker,
            victim=self,
            damage=final_damage,
            raw_damage=damage
        )
        if self.base_health <= 0:
            self.events['die'].fire(
                attacker=attacker,
                victim=self
            )
        return final_damage

    def attack(self, victim):
        """Attacks a victim."""
        final_damage = victim.take_damage(self.damage)
        self.events['attack'].fire(
            attacker=self,
            victim=victim,
            damage=final_damage,
            raw_damage=self.damage
        )
        if not victim.alive:
            self.events['kill'].fire(
                attacker=self,
                victim=victim
            )

    @property
    def health(self):
        """Getter for entity's health."""
        return self.base_health

    @property
    def armor(self):
        """Getter for entity's armor."""
        return self.base_armor

    @property
    def alive(self):
        """Getter for entity's alive state."""
        return self.base_health <= 0

    @property
    def damage(self):
        """Getter for entity's damage."""
        return self.base_damage

First of all, I'm really new to game developing, so any improvements would be nice.
The problem I'm having is that I'm "forced" to return a value from the take_damage() method, in order to include the actual damage in attack()'s event arguments. Would there be any fix for this?


texts: Comparison of two 2d top down player movement scripts in Unity

texts:
I have been following along two different tutorials on making an 2d RPG and comparing the two movement scripts that seem to do the same thing but in different ways. Which is a better way when comparing these scripts?

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float moveSpeed;
    private Animator anim;

    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void Update () {
        if(Input.GetAxisRaw ("Horizontal") > 0.5f || Input.GetAxisRaw ("Horizontal") < -0.5f){
            transform.Translate(new Vector3(Input.GetAxisRaw ("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
        }

        if(Input.GetAxisRaw ("Vertical") > 0.5f || Input.GetAxisRaw ("Vertical") < -0.5f){
            transform.Translate(new Vector3(0f, Input.GetAxisRaw ("Vertical") * moveSpeed * Time.deltaTime, 0f));
        }

        anim.SetFloat ("MoveX", Input.GetAxisRaw("Horizontal"));
        anim.SetFloat ("MoveY", Input.GetAxisRaw("Vertical"));
    }
}

Script 2:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    Rigidbody2D rbody;
    Animator anim;

    // Use this for initialization
    void Start () {
        rbody = GetComponent<Rigidbody2D> ();
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void FixedUpdate () {
        Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (movement_vector != Vector2.zero) {
            anim.SetBool ("Iswalking", true);
            anim.SetFloat ("Input_x", movement_vector.x);
            anim.SetFloat ("Input_y", movement_vector.y);
        } else {
            anim.SetBool ("Iswalking", false);
        }

        rbody.MovePosition (rbody.position + movement_vector * Time.deltaTime);
    }
}


texts: C# UDP Multiplayer Networking - issue with choppiness and consistency

texts:
I know I've done this incorrectly, but I don't know what the right way is.

Right now I have two clients that connect to a server. Each tick the players send a packet of information containing their X,Y to the server. The server takes those packets and sends them to the other clients. So it's like this:

EXAMPLE:
Player1: 1:x,y or 1:100,125
Player2 receives that information, and then moves that instance of a NetPlayer based on the ID (1)

When the NetPlayer receives a new position packet from the server, it calls MovePlayerTo(Vector2 _newPosition);

public void MovePlayerTo(Vector2 _newPosition) {
            this.newPosition = _newPosition;
            //OldPacketPosition = newPosition;
            //newPosition = _newPosition
            //LerpFromOldToNew(OldPacketPosition, newPosition);
}

Then, in the NetPlayer.Draw method (called 60 times a second), the Position is set like so:

 Position.X = MathHelper.Lerp(newPosition.X, Position.X, lerpValue);
 Position.Y = MathHelper.Lerp(newPosition.Y, Position.Y, lerpValue);

This has smoothed the player out pretty well, but it still appears as if it's not being drawn as smooth as a local player, even with interpolation. It seems like it's being drawn at 45FPS. If I lower my client tick delay to 200ms, it lerps very quickly between those positions in short bursts. It doesn't actually make the entire movement smooth.

I've tried changing the MovePlayerTo() to set an OldPacketPosition, and NewPacketPosition, and then lerp between the last packet.position and the new one, and it becomes even choppier, no matter what I set my  (float) lerpValue to.

Also I noticed if I jump up and down a bunch, it doesn't show the NetPlayer hitting the ground. He moves smoothly and kinda bounces before he even hits the ground and shoots back up in the jump animation.

I know I'm doing this improperly. I've seen other people set their tick rate to be really low, and the positions aren't super accurate but the movement is still smooth between packets.

EDIT: Changes:

public void SetPreviousPosition()
        {
            PreviousPos = LastNetPosition;
        }

        public void MovePlayer()
        {
            //Next = packetPosition
            //Previous = player's position when it received the packet
            //Lerp(previous, next);
            Position.X = MathHelper.Lerp(PreviousPos.X, NextPos.X, lerpValue);
            Position.Y = MathHelper.Lerp(PreviousPos.Y, NextPos.Y, lerpValue);

        }

So every packet received by the net player, the handler is calling the MovePlayer() with the new packet position, after setting it's last position to it's current position when the packet is received. It looks smooth, but not nearly smooth enough. The local player still is super smooth by comparison.

Do I need to lerp to the new position over a specific duration? Because right now it's just calling the method every time it receives a positional update from the server.

EDIT: 5/21/20

I just tried using my lerp function in a different program and it moves perfectly. I added a list of random X,Y packets and then had it lerp over it's update call so I'm assuming that's why it's smooth. In the multiplayer game, it can't have a list, because it needs to lerp between currentPos and packetPos. So I don't understand why it immediately stops working.


texts: Stuck trying to decompress sections in Minecraft Anvil files (.mca)

texts:
I've been trying to write some Java code to read .mca files, based on the information at http://wiki.vg/Map_Format and http://wiki.vg/User:Sprenger120 . I am at the point where I can read in the header correctly, and read the header for each section, telling me its compression mode and size. I am now trying to inflate the NBT blob that is the actual section, but it's not working at all. I just get "java.io.IOException: Not in GZIP format".

I'm starting the deflation stream five bytes into the memory segment specified by the header, and given that I am consistently getting sane section sizes and compression types, it seems like I'm managing to parse correctly up to this point, but now I'm stuck.

The code is at: https://github.com/Zarkonnen/Ager/tree/master/src/ager

I don't know if this is the correct forum to ask this kind of question - if it isn't, I apologise and would be very thankful if someone could direct me to a good place to ask it.


texts:
Say I have a framework with characters that can run and walk and of course, stand still.

Am I right in thinking that animation blending is the process of smoothly transitioning between these by generating dynamic animations at runtime?

If so, what is the basic theory of how this works, and how would I implement it?


texts: Libgdx game rendering works only after app resume

texts:
I've encountered a strange problem while trying to develop my game.
I deployed the game to my Honor5C and when I open it, a red screen appears, because (I think) only these 2 standard lines of code are functioning properly:

Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

But every other sprite is NOT being rendered. The thing is, if I go back to the phone's main menu, without closing the app, and then I pop it back up again, everything works fine. Here's my render method:

public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    cam.update();

    world.step(1f/60f, 6, 2);

    batch.begin();
    batch.setProjectionMatrix(cam.combined);
    bgSprite.draw(batch);

    platformSprite.draw(batch);

    idleSprite1.setPosition((playerBody.getPosition().x * PIXELS_TO_METERS) -
            idleSprite1.getWidth() / 2, (playerBody.getPosition().y * PIXELS_TO_METERS) -
            idleSprite1.getHeight() / 2);

    idleSprite1.draw(batch);

    batch.end();
}

What could it be? I've found absolutely nothing googling the issue for an hour straight now. Thank you all.

EDIT @ Charanor

No static variables are being used.
Here's the initialization for the variables used in the render method:

batch = new SpriteBatch();

    background = new Texture(Gdx.files.internal("data/bg.jpg"));
    bgSprite = new Sprite(background);
    bgSprite.setPosition(-683f, -384f);

    platform = new Texture(Gdx.files.internal("data/platform.jpg"));
    platformSprite = new Sprite(platform);
    platformSprite.setPosition(-50f, -100f);

    idle1 = new Texture(Gdx.files.internal("data/Idle.png"));
    idleSprite1 = new Sprite(idle1);
    idleSprite1.setPosition(-70f, 0);

    cam = new OrthographicCamera();
    cam.position.set(0,0,0);

    viewport = new StretchViewport(1366f, 768f, cam);
    viewport.apply();

EDIT 2: I've discovered the game still keeps not working if, after launching it, you press the android "back" button and then pop the game back up . The red screen stays. It appears the only way to make it work is to launch the app, press the android button that lets you see what applications are active and switch back to the game from there. It's getting ridiculous.

EDIT 3: I've done some more testing and here's what I found: if you deselect the app and reselect it again either with the recent apps button or the home button we know it works. But, if you press the android back button (it goes back to the phone main menu) after the game is already working fine, and then reopen it, the problem comes back and the screen goes back to full red!


texts: Whenever I research audio in LWJGL 3, they always use STB which can only load Ogg files. All of my audio files are in either WAV or MP3 format, and it would be annoying to have to convert all of them. Is there some other library or method I can use that would allow me to load these file formats?


texts:
I have developed a prototype for a new game concept. The game is an educational foreign language learning tool for K-16 students.

I am at the point where I need to test with sample groups of students, but would like some guidance on the following:

Beta testing software: My game is a prototype, so I know it will have bugs. I'm more concerned with gathering metrics on how users enjoy the product, if they learn from it, what features were most valuable to them, what features they could do without, and what features they were looking for. I'm not sure if a Bug Tracker is the way to go, but is there something else that can capture user feedback in this way?
For an educational prototype with a target demographic, what aspects should I be looking to test (software-wise, I realize I haven't given much context as to what the game is about or what it is trying to teach)? How should the tests be conducted to be the most efficient/effective? I realize this is a tad subjective, so I'm looking for the most objective methodologies for early beta tests, if any exist.

As far as software, http://www.centercode.com/ was recommended. After going through their tutorial teaser, their tool looks comprehensive with bug reporting, suggestions, dashboards, etc, but also they mention connecting and sending bugs off to their dev teams to fix.

At $499/mo, I'm wondering if it's sensible to use a tool like that if I am the sole developer, or for round 1 testing I should just create some ad hoc feedback collection tools?

Any other pointers would be extremely appreciated.


texts: How to convert this shader from Worldspace into Localspace?

texts:
Based on this question (LINK)

Shader "Unlit/WorldspaceTiling"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);

                // Gets the xy position of the vertex in worldspace.
                float2 worldXY = mul(_Object2World, v.vertex).xy;
                // Use the worldspace coords instead of the mesh's UVs.
                o.uv = TRANSFORM_TEX(worldXY, _MainTex);

                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                return col;
            }
            ENDCG
        }
    }
}

So this has these two issues:

a) If the object moves through worldspace (eg. a moving platform), the texture will appear to crawl along it.
b) Rotating the object won't rotate the texture, so it will tile across it diagonally.

How is this code supposed to be to fix these two problems?
EDIT:
This is what I'm trying to achieve over all:

I have no idea if my current method is good or bad, but its basically:

Use a flat mesh created in blender with UVs unwrapped. They're all basically a bunch of quads with UVs having literally the shape same as the mesh itself.
Attach a material to each mesh in Unity with a particular texture.
Resize, rotate and align mesh into correct size and position.
Use as physics object in a 2D sideview game. May have additional meshes attached to it as non-interactive decorations, but otherwise using the same method to build them.


texts:
I'm working on a grid- and turn-based strategy rpg. My problem is concerning finding best position for my AI to use a skill. But lets start at the beginning.

My plan is to make each skill an action for my AI. It checks for each action how effective it would be, chooses the best and does it.

Each skill has a usage and a affect area that can be circular or shapes like

[
 [1,1,1,1,1],
 [0,1,1,1,0],
 [0,0,1,0,0]
]

which can be used in 4 directions.

The most simple solution would be to just check the affect area for each position and direction of the movable and usage area. But as these checks can get quite intensive I want to minimize them as far as possible.

One approach would be to combine the circular movement area with the skills usage and affect areas and find all target entities in it. So I have a list of all entities that could be targeted by the skill. The next step would be to group these entities by the skills affect area to rate it higher when the skill hits multiple targets. And as the new position and direction should get into that rating as well I have to check all possible positions for each group.
And I've no idea on how to effectively do that.

1) Does this AI approach makes sense?

2) Is there a better way to define such grid-shapes and apply them to the checks later on?

3) Any ideas on how to group the targets by the skills usage area or minimize the positions and directions to check by the knowledge of where the target entities are?

Thanks for reading!

EDIT: After this is not going to get answered I have to ask another question: Am I bad in asking for help? In the 10 year's I'm developing now there were like five times were I really couldn't get further without a tip. But unless which way I try to ask for help (in the internet, asking the few developers I know or someone outside of the industry for understanding problems) I've never got any. To be fair I'm only coming with real problems after being stuck for days. But as I see the internet full of perfectly answered questions I begin to think: Is that my fault? What makes this question not worthy for an answer?


texts: Managing game states (states flow, controlling the state machine...)

texts:
I am currently struggling really bad to make the game states management. Before we dig into the problem, I must point out that I do know about state machines, I do have both implemented (states and state machine) and they look SIMILAR to this, or you can also see my real outdated implementation from my github.
Alright, my questions are:

Do states usually operate state machines? Eg.: when the LoadingState
finishes (based on the 'update' method) loading something, it tells
the state machine to pop the stack (which would pop the
LoadingState) and to push a new state, such as PlayingState OR
should the LoadingState only notify the state machine and the state
machine itself will be responsible of knowing whats the next state
based on the state that has requested a pop? Knowing which state has
requested a pop (pop, push or whatever) is kind of difficult because
it needs some advanced C++11 stuff, which requires a lot of
'not-easy-to-understand' code and validations (asserts), unless we
use an enumeration inside each state and do a simple switch (again,
more typing).
Should the state machine be opperated/accessed (pointer/static
functions) by any component (class, system, manager...) of the game?
Eg.: the main player has moved into a map teleport and it triggered
a map load, since it should be teleported to a new map. Should the
Map class notify the state machine to push the MapTransitionState
into the stack, through a static (it doesnt really make any sense to
have a pointer to the state machine in the map class) public
function?

Thanks a lot!


texts: How to efficiently average multiple rotations (quaternions)?

texts:
So, I'm working on an animation system in C++, and am trying to blend multiple animations together. A slerp is easy on two quaternions, but is it efficient (or accurate) to chain together for more than two quaternions? I would think there'd be a better way.
I did stumble upon this thread outlining an approach in Unity,  but it looks pretty cumbersome, and a lot of it doesn't translate easily into the code base I'm working with.  I have actually implemented the eigenvalue-based approach, but it is very slow. There must be a more efficient way!


texts: Sprites are rendered as black rectangles in android 4.0.x only

texts:
I have some problems rendering sprites correctly on a LG optimus vu (android version 4.0) with libgdx.
Basically sprites are black rectangles, while other images that i declare as Texture are correct.
I've tested my game with android 4.2 4.3 and 5.0 and I have no problems...

Is there some difference between 4.0 and 4.2 in graphics rendering? Maybe it's Gl10 and not Gl20?


texts:
This was probably asked somewhere but I can't google anything for some reason.
So I'm making a puzzle game as a result I have lots of booleans which affect the game only once and become redundant.
As an example, to enter some door player needs to pickup a key so there is check for that. After that when hero enters a doors for the first there is a special animation triggered.
So after player had entered the door  this checks are no longer neccery.

I am not worried about perfomance but rather code design.
Maybe there is some clever trick to manage game state without bunch of ifs and bools?


texts: What do you look for in a scripting language?

texts:
I'm writing a little embedded language for another project. While game development was not its original intent, it's starting to look like a good fit, and I figure I'll develop it in that vein at some point.

Without revealing any details (to avoid bias), I'm curious to know:

What features do you love in a scripting language for game development?

If you've used Lua, Python, or another embedded language such as Tcl or Guile as your primary scripting language in a game project, what aspects did you find the most useful?

Language features (lambdas, classes, parallelism)
Implementation features (performance optimisations, JIT, hardware acceleration)
Integration features (C, C++, or .NET bindings)
Or something entirely different?


texts: How to correctly create bullet rigid from custom .mesh in Ogre?

texts:
Being new to 3d programming and bullet physics in particular, I am wondering how a 3d model or the mesh generated out of it effects the accuracy of bullet physics simulation.

I have written a small Ogre 3d application in C++, including/using bullet for physics. In a small scene I add a plane as ground and three boxes (simple blender objects that come with Ogre) that have their initial position a bit over that ground. So after starting the application those three boxes fall down until they hit the ground plane, where they move a bit, depending on their initial height and rotation, until they come to a halt.

Watching that scene the bullet physics simulation looks very accurate and realistic, also the boxes seem to touch the ground very exactly.

Ok, then I have created a box model in Sketchup 8 and exported it to an Ogre .mesh file. Then I use this model instead for those three boxes in my scene. The C++ code itself is not changed at all (except that I load the new .mesh file for the boxes).

However, even though on the screen those new box models look exactly as the original ones, their movement is not correct any more. They fall to the ground plane fine, but then they move very weird, it looks not as realistic as before. Even worse, after they have stopped their movement those three boxes now "float" a bit over the ground plane, they do not touch it. I can also see their shadow now below the box on the plane, so they are really not touching the ground plane.

TL;DR: Scene with three boxes, falling down to the ground, simulated by bullet. That works fine with default Ogre (blender) .mesh files for the boxes. But with custom Sketchup models (.mesh files) instead for the boxes, but the same code, the bullet simulation does not work correctly any more.

My question is: how does the mesh of a model impact the accuracy of bullet?
And: what can I do to solve that issue with my custom Sketchup models?

PS: I load the .mesh file and convert it to a bullet rigid body as following:

m_pSceneMgr->createEntity("Cube1", "Cube.mesh");
...
BtOgre::StaticMeshToShapeConverter converter(m_pSceneMgr->getEntity("Cube1"));
btCollisionShape* colShape = converter.createBox();


texts: Voxel sparse octrees for indirect illumination

texts: I don't understand the use of voxel sparse octrees for indirect illumination calculations. First of all, what exactly is happing? We're rendering the scene as usual with diffuse lighting. In the meantime, we're maintaining the octree of our scene. But when do we use it and for what exactly?


texts: How to get smoother transition between the surface normals rotation of player in Unity

texts:
I kinda have a problem that my player is snapping onto the other surface while I wanna move a ramp up. I want to have it rotate smooth to the normals of the ramp. How can I change the code below to a smoother rotation function of the player?

Code:

void NormalsOfGround()
{
    //RAYCASTS THE NORMALS ON THE GROUND THAT THE PLAYER MOVES ALONG SURFACE
    Debug.DrawRay(rayCastNormal.transform.position, -transform.up, Color.blue, 2.5f);
    Ray ray = new Ray (transform.position, -transform.up);
    RaycastHit hit;
    if(Physics.Raycast(ray, out hit, 2.5f, GroundLayer) == true)
    {
        transform.rotation = Quaternion.FromToRotation (transform.up, hit.normal) * transform.rotation;
    }
}


texts: Which software to keep track of my project?

texts:
I'm about to start the first real phase of my game development which will consist of the acquisition of information, resources and the definition of where I want to go and what I will need for that. I just want to make sure that I'm prepared as best as possible before I actually start development.

I don't like the thought of using Microsoft Word or Excel for my project management... I already worked with MS Project but I don't think it fits my needs.

I need a software where I can easily maintain project steps, milestones, important issues, information about technologies and engines I use, as well as simple notes and thoughts I just want to write down.

I usually prefer a whiteboard for stuff like that but unfortunately it's not a persistent way of storing. ;) Also writing it down the old-school way is something I can think of, but only for quick notes...

Which software do you use for that?
Are there commonly used programs?
Is there any free software at all?


texts: Content loading, Content processing and add processed file to a DataContainer?

texts:
I'm trying to create some kind of editor in Windows Forms for XNA and I was wondering if there's anyway to do this:

Load content (known types, like Model/SpriteFont/Effect/Texture) through OpenFileDialog, then Process it to an *.xnb file and finally be able to add it to a datacontainer, so you can use it in an editor.

Is this possible, and since I only want to use known types that already have Importers/Processors - what is the best way to go about doing this?

Because for me, to just manually have to add content when later creating the game logic and having everything set up in the editor feels very static.

So simply put, I want to be able to load content and process it and later be able to store it so when I create a game using this I can add a DataContainer that I can change and add to in the editor as well as use in the game.

Doing Content.Load() 2000 times later in the game feels like a time waster.


texts: How can I reorient the axes of an object?

texts:
I spent some time in Unity yesterday trying to fire a sphere from a horizontal cylinder (like a ball from a cannon). I was using Vector3.forward, but the sphere kept coming out the top of the cylinder rather than the front. Someone suggested using Vector3.up instead, and sure enough it worked!

The cylinder is vertical by default. So, it appears that when I rotated the cylinder by 90 degrees to lay it flat, the local axes remained the same. The relative front of the cylinder remained at the same point, so when I fired the sphere it shot out the new "top", not what looked to me like the "front". If I had happened to be facing the other way, I would have had to fire at Vector3.down instead.

How can I reorient/reset the axes of an object so that they match my expectations? (And if I can't, how can I tell by looking which way an object is oriented?)


texts: What is the most efficient way to find hit point of BOX and internal Ray?

texts:
most efficient AABB vs Ray collision algorithms
I found this topic on AABB ray test. Some of them could find hit point of external Ray and BOX.
I did my version for both external and internal ray, but it seem not working for internal ray.
What's the problem on my solution? Or any good algo for this use case?
   bool hit(thread Ray& ray, float2 range_t, thread HitRecord& record) const constant {

        float tmin = range_t.x;
        float tmax = range_t.y;

        float3 normal = float3(0);

        for (auto i : {0, 1, 2}) {

            auto min_bound = (mini[i] - ray.origin[i])/ray.direction[i];
            auto max_bound = (maxi[i] - ray.origin[i])/ray.direction[i];

            auto ts = min(max_bound, min_bound);
            auto te = max(max_bound, min_bound);

            tmin = max(ts, tmin);
            tmax = min(te, tmax);

            if (tmax < tmin) { return false; }
            //if (tmax <= tmin || tmax < 0) { return false; }
            //if (tmax <= tmin || tmax < 0 || tmin < 0) { return false; }

            if (ts >= tmin) {
                //tmin = ts;
                normal = float3(0);
                normal[i] = abs(min_bound) < abs(max_bound)? -1:1;
            }
        }

        record.t = tmin;
        record.n = normal;

        if (tmin < 0) {
            record.t = tmax;
        }

        return true;
    }

```


texts:
I am applying a 3D Voronoi pattern on a mesh. Using those loops, I am able to compute the cell position, an id and the distance.

But I would like to compute a normal based on the generated pattern.
How can I generate a normal or reorient the current normal based on this pattern and associated cells ?

The aim is to provide a faced look for the mesh. Each cell's normal should point in the same direction and adjacent cells point in different directions. Those directions should be based on the original mesh normals, I don't want to totally break mesh normals and have those points in random directions.

Here's how I generate the Voronoi pattern.

float3 p = floor(position);
float3 f = frac(position);
float id = 0.0;
float distance = 10.0;

for (int k = -1; k <= 1; k++)
{
    for (int j = -1; j <= 1; j++)
    {
        for (int i = -1; i <= 1; i++)
        {
            float3 cell = float3(float(i), float(j), float(k));
            float3 random = hash3(p + cell);
            float3 r = cell - f + random * angleOffset;
            float d = dot(r, r);

            if (d < distance)
            {
                id = random;
                distance = d;
                cellPosition = cell + p;
                normal = ?
            }
        }
    }
}

And here's the hash function :

float3 hash3(float3 x)
{
    x = float3(dot(x, float3(127.1, 311.7, 74.7)),
        dot(x, float3(269.5, 183.3, 246.1)),
        dot(x, float3(113.5, 271.9, 124.6)));

    return frac(sin(x)*43758.5453123);
}


texts: Is Free2Play w/ cash shop "non-commercial"?

texts:
I'm new to game development and considered using the Unreal Development Kid for a test game. The website states it is free for non-commercial use. I know that games that can be obtained free of charge are considered non-commercial.

However, my mind came up with the question: What are free-to-play games with cash-shops categorized as? Not saying I'm planning to embed one in my test game, that would be just non-sense.

A quick Google search couldn't come up with any answer, especially since I'm unsure of what to search.


texts:
I Have a character in my game that must go when player hold finger at the screen, but when I swipe character first go, and then do swipe. (for example jumping - character first go, and only then jump).
This my code for touch:

 if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            startTime = Time.time;
            startPos = touch.position;
        }
        else if (touch.phase == TouchPhase.Ended)
        {
            endTime = Time.time;
            endPos = touch.position;
            swipeDist = (endPos - startPos).magnitude;
            swipeTime = endTime - startTime;

            if (swipeTime < maxTime && swipeDist > minSwipeDist)
            {
                swipe();
            }
        }
        else if (touch.phase == TouchPhase.Stationary && isTap == 0)
        {
           hold();
        }
    }

This my code for a hold:

  void hold()
{

        moveVelocity = 3f;

}

And for swipe:

void swipe()
{
    Vector2 distance = endPos - startPos;
        if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
    {
           if (distance.x > 0)
        {
            Debug.Log("Right swipe");
        }
        if (distance.x < 0)
        {
           Debug.Log("Left swipe");
        }
    }
    if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
    {
        if (distance.y > 0)
        {
            Debug.Log("Up swipe");
        }
        if (distance.y < 0)
        {
            Debug.Log("Down swipe");
        }
    }
}

My question is: When player swipe left character first go, and only then do swipe left. I want player swipe, without going forward. How can I do this?


texts: How to display a huge image in Unity 2D scene?

texts: I need to display a huge image (big like earth)  in a 2D scene,  it is a PNG format image of real world map. I think like the other map APPs, the map image should be loaded and displayed tiles by tiles, not the whole one at a time, but how to display them properly and efficiently? What I can think of is, generating serval GameObjects and set the tile images as sprite of SpriteRenderer to them. But is that stupid? I thought there should be more advanced way to achieve it. Could anyone give some advices? Very appreciate it!


texts:
I'm surprised that this issue is nowhere to be found on these forums... Well at least when I searched. So, on my setup I have created a cube and applied a Rigidbody to the object with the following C# script:

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {
    Rigidbody movement;
    float distToGround;
    bool doubleJump=false;
    void Start() {
        movement = GetComponent<Rigidbody>();//Initialize movement as their rigidbody
        distToGround = GetComponent<Collider>().bounds.extents.y;//Get the distance from the user to the ground
    }
    void Update() {

        /*If they aren't moving the horizontal or vertical axes, cancel out their velocity.*/
        if(Input.GetAxis("Horizontal")==0&&isGrounded()) movement.velocity = new Vector3(0, movement.velocity.y, movement.velocity.z);
        if(Input.GetAxis("Vertical")==0&&isGrounded()) movement.velocity = new Vector3(movement.velocity.x, movement.velocity.y, 0);

        /*Horizontal Movement*/
        if(Input.GetAxis("Horizontal")>0) movement.velocity = new Vector3(5, movement.velocity.y, movement.velocity.z);
        if(Input.GetAxis("Horizontal")<0) movement.velocity = new Vector3(-5, movement.velocity.y, movement.velocity.z);

        /*Vertical Movement*/
        if(Input.GetAxis("Vertical")>0) movement.velocity = new Vector3(movement.velocity.x, movement.velocity.y, 5);
        if(Input.GetAxis("Vertical")<0) movement.velocity = new Vector3(movement.velocity.x, movement.velocity.y, -5);

        /*Jumping and Falling*/
        if(Input.GetButtonDown("Jump")&&isGrounded()) Jump();//For jumping
        if(!isGrounded()) {//If they are in the air
            Gravity();//They're free... free falling!
            if(Input.GetButtonDown("Jump")&&doubleJump) {//If they jumped once
                if(Input.GetAxis("Horizontal")==0&&Input.GetAxis("Vertical")==0) {//And they aren't moving
                    Jump(); doubleJump=false;//Double Jump
                }
                else if(Input.GetAxis("Horizontal")>0) {//Otherwise, if they're trying to dodge right...
                    movement.AddForce(10, 0, 0, ForceMode.Impulse); doubleJump=false;//Dodge Right!
                    print("Dodged!");
                }
            }
        }
        if(isGrounded()) doubleJump=true;//Reset Double Jump bool
    }

    void Gravity() {
        movement.AddForce(movement.velocity.x, -20, movement.velocity.z);//Simply push them down consistently
    }
    void Jump() {
        movement.velocity = Vector3.zero;
        movement.velocity = new Vector3(movement.velocity.x, 15, movement.velocity.z);//Simply push them up consistently
    }
    bool isGrounded() {
        return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1f);//returns whether or not the object is grounded
    }
}

Everything works fine in this code except for the code that allows them to dodge mid-air. Whenever I perform a jump successfully and jump again without pressing an arrow key, it double jumps as expected.
Whenever I dodge right, I noticed that the object seemed to "teleport" or "skip" in the direction a bit instead of actually applying the force. The more force I apply, the more it skips.
Why is my code executing it in this way? Is it a glitch with Rigidbody or is it a problem with my code that I'm not realizing?


texts: What are milestones for a game developer to gauge their progress?

texts:
I know actually completing a game is a massive milestone, a complete polished, holistic experience. Something that I've not yet been able to commit to.

There are of course classes and degrees to earn in several fields that will help gain experience, but how would one judge their own progress and strive to progress further?

The yellow brick road to "Rock Star Game Programmer" is very cloudy. At this point I think it may be closer to an ocean, drifting along until you wake up one day at your destination.


texts: Introduction movie running before game starts

texts: There are many games out there that feature a movie or cut scene to feature either in-game features or to set the mood for the player. Some examples are the intro from Tony Hawk Pro Skater 4, Fifa Street 2, Modern Warfare 3, etc. How do I integrate a movie I made to Unity so it launches right at the start, ends playing and then shows the main menu? Is it available for unity personal edition or is it only for pro users?


texts: Guidance for building a proper in game economy

texts:
I'm seriously thinking of building a space opera game which would share some of Machiavelli The Prince aspects regarding commerce: each player will be able to extract/build/buy/sell/donate a wide range of products (from ore to spaceships roughly).

However, I'm struggling with the economy aspect of it. Should the game define the prices once and for all? Should each player be able to determine his own buy/sell prices, and if so, how? How can I avoid over engineering this game economy mechanism, while still making it attractive for users?

Edit: thanks to your very nice input, some more information about the setup:

it's a "player only game," with no "computer managed player."
players start with a planet and some resources/units and then (try to) expand
players can be of multiple "species" with no proper relationship apart from the one they might make up => no possible notion of "central bank" or similar in the first place
consequently, I would prefer "not magic" on the economy, by that I mean a standard currency whose value would be determined by the system. However then I don't see how trading would be appealing, since bartering would be the only way, which feels a bit clumsy for the players. I was thinking of having some rare metal as the standard exchange medium, but then I wonder how would to include other basic economic attributes, such as the population's wealth...

Hopefully it doesn't look too daunting...


texts: How to make different layers in a 2d game map

texts:
My question is this:  How do I make a gamemap from the drawings on my spritesheet?

The tutorial I have followed for making a java 2D game uses this technique to make a gamemap: in photoshop I create a new document with each pixel representing a tile in the game map. Each tile is assigned a unique hexadecimal color value and from there it is a breeze to load the .png file into the game.

However, now that I have a complete map filled with all the basic tiles, it's still a very empty map. I want trees, bushes, flowers on my grass tiles. seaweed, water lilies, driftswood and whatnot on my water tiles. All sorts of scenary that is simply a must to make a simple game map. Many of these "scenery" objects I intend to design bigger than 1 tile (structures, for example). And not necessarily entire tiles either (some will have transparent parts). I'm at a complete loss and don't even know what to expect for an answer.

Am I supposed to draw a tree (with a mass of 8 tiles) as 8 seperate tiles? Am i supposed to draw even larger objects (20x20 warehouses) on top of basic tiles? What I really hope to learn is how the gamemaps have been made in the Pokemon games for gameboy, for instance.

My current thoughts are to design a new class in my projects resembling the Tile class, this one Scenary. Like Tile it will contain an array of every single scenary object in the game, each with a unique color code to be represented as a pixel in a .png document. The pixel representing the start-point of the scenary and the individual scenary object should contain information about how to render from its start position.

If not entirely ridiculous this method can't possibly the right way to go. The Scenary class could, unlike the Tile class, have potentially hundreds of objects in its array.


texts: How can I animate a colour change over hue/saturation/value instead of RGB in Blender?

texts:
If I create a keyframe for a colour in Blender (I'm using 2.6) it always seems to traverse the RGB values for the animation, even if I set the colour using HSV values.

I do this by setting the colour, using HSV, then pressing i over it.

How can I animate the HSV values rather than the RGB values?


texts:
Hi I've have spent the past few days googling how to do this and I'm making no progress. I have created a png image for each of the sized icon 36x36, 48x48, 72x72,96x96, 144x144 & 192x192. But when I load my app on any device the default icon apps. This is preventing me from uploading my game to the store as I don't want users to have a game with no icon.

Can anyone help get these icons to actually appear. I have tried different devices, uninstalling the app and reinstalling but still no luck. Do the images have to be a certain format, or any setting need selecting with in unity to make them compatible?


texts: How do I set up a depth buffer in SharpDX?

texts:
I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes.

I already had this issue a long time before and i remembered that is was because the depth buffer.

I don't know how to set up a depth buffer in SharpDX.

My current trial:

DepthStencilView depthStencilView;

Init

var zBufferTextureDescription = new Texture2DDescription
        {
            Format = Format.D16_UNorm,
            ArraySize = 1,
            MipLevels = 1,
            Width = this.RenderWindow.ClientSize.Width,
            Height = this.RenderWindow.ClientSize.Height,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None
        };
using (var zBufferTexture = new Texture2D(Device, zBufferTextureDescription))
  depthStencilView = new DepthStencilView(Device, zBufferTexture);

DeviceContext.OutputMerger.SetTargets(depthStencilView, RenderTargetView);

Draw

//ClearRenderTargetView
DeviceContext.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1f, 0);
//DrawInstanced(...);

My question: what steps do i have to do, to set up a depth buffer correctly?

(I don't use SharpDX.Toolkit)


texts:
I'm currently writing a 2d tile scroller for a hobby project and I can't find any resources to give me a clear answer to which is more efficient to do.

Each block contains tiles 44 by 24, 32px x 32px in size, and I'm rendering all immediately-adjacent blocks offscreen. With each block, I am specifying what the types of the tiles are, such as Sand, Grass, Pavement, etc. My end goal is to have dozens of unique tiles in each set, potentially having several "Grass" sets to pull from, to have a diverse set of landscapes.

What I want to do:
I would like to only load tilesets that have tiles that appear in the loaded blocks. I would do this by marking tile "families" in Tiled, as well as giving them an ID that pertains to that tileset specifically.

However, I don't know if it's just better to load all of the tiles from one large tileset on the game's start and just keep it in memory, instead of making frequent content loads

Will the game potentially run more efficiently dynamically loading tilesets based on need, or one very large tileset when the game first starts?


texts: how can we define dynamic Path of ViewObject(Bitmap) On Canvas

texts:
I am Currently working on One 2D Android Game,

In this game One ViewObject(Bitmap) is moving Across Screen On Parabola Path Like in this Image, But this Path is Static, the Static path is getting throught the Drawing with Fingure on canvas,

As Same as signature Drawing.

The Bitmap Move code On this Static Path is

//animation step
private static int iMaxAnimationStep = 900;
private int iCurStep = 0;
private Path ptCurve = new Path(); //curve
private PathMeasure pm;            //curve measure
private float fSegmentLen;         //curve segment length

 //init smooth curve
    PointF point = aPoints.get(0);
    ptCurve.moveTo(point.x, point.y);

    for(int i = 0; i < aPoints.size() - 1; i++){
        point = aPoints.get(i);
        PointF next = aPoints.get(i+1);
  ptCurve.quadTo(point.x, point.y, (next.x + point.x) / 2, (point.y + next.y) / 2);
    }

    pm = new PathMeasure(ptCurve, false);
    fSegmentLen = pm.getLength() / iMaxAnimationStep;//20 animation steps

    //animate the Bitmap
    Matrix  mxTransform = new Matrix();
    if (iCurStep <= iMaxAnimationStep)
    {

        pm.getMatrix(fSegmentLen * iCurStep, mxTransform,
                PathMeasure.POSITION_MATRIX_FLAG);
        mxTransform.preTranslate(-Bitmap.getWidth(), -Bitmap.getHeight());

       canvas.drawBitmap(Bitmap, mxTransform, null);

        iCurStep++; //advance to the next step
        mPauseViewHandler.post(mPauseViewRunnable);
    } else {
        iCurStep = 0;

    }

But My Problem is I want to Move This ViewObject(Bitmap) On Dynamic Path(in parabola curve) & that Dynamic curved path will work in Any Device.

I have searched Lot but i can't Find Solution How to get Dynamic Path (in parabola curve).

help! If you have Any Solution,Suggestion, idea ,tutorial regarding this post is Mostly Appreciated.


texts: Best way to create neon glow line effect in AS3?

texts:
What's the best way to create a neon glow line effect in Flash AS3? Say similar to what's going on in the game gravitron360 on the xbox 360?

Would it be a good idea to create movieclips with plain lines drawn in them and then apply a glow filter to them? or perhaps just apply the glow filter to the entire movieclip layer the movieclips are on? or just draw them manually and create a glow effect by converting the lines to fills and then softening edges? (wouldn't blend as well but would be the fastest CPU wise?)

Thanks for any help


texts:
I have googled this to death, and I still don't quite understand it.

I'm trying to create a glow effect in XNA using HLSL. A long time ago I was able to do it the way most people suggest which is by sampling the pixels from a texture, however I've always been curious about how you can make it more advanced so that you could do things like set the glow distance and stuff. If I recall from back when I was creating something like this in a similar project, there was always a limit as to how much I could sample before the computer couldn't handle it, hence limiting the glow distance. I wanted to know if there was a more sophisticated way of doing it, one that would have no glow distance limit? And I'm not referring to lighting ground textures either, the idea I have in my head is to have a set of vertices that all join together to create a LineList (for this example lets say they create a cube), so you have very thin lines creating a shape, and then you can set a glow on this object that has no limit to its distance, kinda like how Photoshop works I guess.

Thanks


texts:
Where is a good place to look for people interested in creating games online? I'll be using XNA.

I'm going to start the project later this week, but I'm definitely commited to it. I'd like to find people who won't hit it and quit it after a month.


texts:
I want to add a short audio track to a game of concentration I'm coding. I want the sound to occur when the user has won the game. How do I go about doing this?
I would really appreciate the help, thank you.


texts: Where can I find free or buy "next-gen" 3D Assets?

texts:
Usually I buy 3D Assets from sites like turbosquid.com or similar.

My problem is that I have lately implemented glow, normal maps, specular (and specular power) maps and reflection maps and I can't find any models that use those techniques.

So where can I find / buy "next gen" assets (at least models/items with a normal map)?

I have checked for similar posts but those I found are about either free only or 2D or 'ordinary' 3D so I hope this is not a duplicate.


texts: Box2D - Proper way to simulate player's body and feet

texts:
I'm new to LibGDX and Box2D, and I'm trying to create my player's body but got some issues.

I've created the ground as a ChainShape, and my player as a Rectangle. I want to attach a fixture for its feet, so I tried adding an EdgeShape but - correct me if I'm wrong- it seems that an EdgeShape cannot collide with a ChainShape.

Is there a proper way to create the player's feet? Should I change my ground from ChainShape to Rectangles or should I use some other shape for the feet?

Edit:
Following DMGregory's advice, I've made some progress.
Since my print statements won't be of much help, I'll post this link with a very detailed explanation:
https://stackoverflow.com/questions/7459208/distinguish-between-collision-surface-orientations-in-box2d

And some background reading here:
https://www.iforce2d.net/b2dtut/collision-anatomy


texts: Quaternion.LookRotation on z-up gameEngine

texts:
I'm trying to implement a look rotation method, similar to Unitys one, but with the difference that in Unity, Z is forward, and in my engine, Z is up. I have an implementation where Z is forward, and I'm not able to convert it.

My "engine" is the GTA V .net Script Hook; I'm making a mod. The function is not working as expected. It gives wrong rotations, and I think it's because of the different coordinate systems, as I said above.

This is the function, currently:

private static Quaternion LookRotation(Vector3 forward, Vector3 up)
{
    forward = Vector3.Normalize(forward);
    Vector3 right = Vector3.Normalize(Vector3.Cross(up, forward));
    up = Vector3.Cross(forward, right);
    var m00 = right.x;
    var m01 = right.y;
    var m02 = right.z;
    var m10 = up.x;
    var m11 = up.y;
    var m12 = up.z;
    var m20 = forward.x;
    var m21 = forward.y;
    var m22 = forward.z;
    float num8 = (m00 + m11) + m22;
    var quaternion = new Quaternion();

    if (num8 > 0f)
    {
        var num = (float)Math.Sqrt(num8 + 1f);
        quaternion.w = num * 0.5f;
        num = 0.5f / num;
        quaternion.x = (m12 - m21) * num;
        quaternion.y = (m20 - m02) * num;
        quaternion.z = (m01 - m10) * num;
        return quaternion;
    }

    if ((m00 >= m11) && (m00 >= m22))
    {
        var num7 = (float)Math.Sqrt(((1f + m00) - m11) - m22);
        var num4 = 0.5f / num7;
        quaternion.x = 0.5f * num7;
        quaternion.y = (m01 + m10) * num4;
        quaternion.z = (m02 + m20) * num4;
        quaternion.w = (m12 - m21) * num4;
        return quaternion;
    }

    if (m11 > m22)
    {
        var num6 = (float)Math.Sqrt(((1f + m11) - m00) - m22);
        var num3 = 0.5f / num6;
        quaternion.x = (m10 + m01) * num3;
        quaternion.y = 0.5f * num6;
        quaternion.z = (m21 + m12) * num3;
        quaternion.w = (m20 - m02) * num3;
        return quaternion;
    }

    var num5 = (float)Math.Sqrt(((1f + m22) - m00) - m11);
    var num2 = 0.5f / num5;
    quaternion.x = (m20 + m02) * num2;
    quaternion.y = (m21 + m12) * num2;
    quaternion.z = 0.5f * num5;
    quaternion.w = (m01 - m10) * num2;

    return quaternion;
}

As a workaround, I'm doing this:

velocityQuaternion = MathR.LookAt(Vector3.Zero, entity.velocity);

but it gives the wrong rotations when the entity rotates at extreme angles (when it rolls over, for example). LookAt is much like Transform.LookAt, in Unity.

I'm trying to use LookRotation like this:

 velocityQuaternion = MathR.LookRotation(veh.Velocity, Vector3.WorldUp);
 // Vector3.WorldUp is (0f,0f,1f)

 targetCamera.Position = veh.Position + (velocityQuaternion * Vector3.RelativeBack * distance); // Vector3.RelativeBack is (0, -1, 0)

The camera shuold be placed rear the vehicle when it goes forward, but instead, it's placed at the right, so you see the bottom side of the vehicle instead of rear (the camera places below the floor itself). If I use the vehicle quarternion instead of velocityQuaternion it works fine

I think this can be useful to determine what the diffrerences between coordinate systems are:

These ones are of the engine I currently use:

    // GTAV script hook vector3 shortcuts
    Back vector. (0,-1,0)
    Bottom vector. (0,0,-1)
    Front vector. (0,1,0)
    Left vector.(-1,0,0)
    Right vector. (1,0,0)
    Top vector. (0,0,1)

And these ones are of unity (which is left handed) (LookRotation was originally written for this coordinate system)

   // Unity vector3 shortcuts
   back => (0, 0, -1).
   down => (0, -1, 0).
   forward => (0, 0, 1).
   left => (-1, 0, 0).
   right => (1, 0, 0).
   up => (0, 1, 0).

What am I doing wrong?


texts: Is There a Way to See Code Inside DnD Actions in Gamemaker Studio?

texts: I'd like to see the script inside the Drag & Drop actions in Gamemaker Studio. I figure it would be one of the easiest ways to learn GML, and generally a great reference, but I haven't come across any mentions of how to do that; is there a way?


texts: Problem with InverseTransformDirection and non-uniform scale

texts:
I made the plane to work with mesh vertices
var plane = new Plane(
    hit.transform.InverseTransformDirection(normal),
    hit.transform.InverseTransformPoint(position)
);

If the object has the uniform scale then all looks good

but otherwise the plane normal has weird angle and I don't understand why.

with InverseTransformVector even worser. The angle goes 2 times bigger

Blue line - my plane
Green spheres - plane intersections
white sphere - plane center
Maybe it can be calculated directly with worldToLocalMatrix?
UPDATE:
Okay It is so weird for me. After InverseTransform plane prints in console right normal but has wrong real angle.
There is code to reproduce
Place component to default cube in zero position, rotate it with Y != 0, scale ONE horizontal dimesion. You will see onesided plane.
using UnityEngine;

public class PlaceOnCube : MonoBehaviour
{
    public Vector3 PlaneOrigin = new Vector3(0, 0, 0);
    public Vector3 PlaneNormal = new Vector3(1, 0, 0);

    private void OnDrawGizmos()
    {
        Gizmos.DrawSphere(PlaneOrigin, .03f);

        var plane = new Plane(
               transform.InverseTransformDirection(PlaneNormal),
               transform.InverseTransformPoint(PlaneOrigin)
               );

        ReGeneratePlane(plane);
    }

    private void ReGeneratePlane(Plane plane)
    {
        var meshfilter = transform.GetComponent<MeshFilter>();
        var mesh = meshfilter.mesh;
        var tris = mesh.triangles;
        var verts = mesh.vertices;
        var newTris = new int[36 + 6];
        var newVerts = new Vector3[24 + 4];

        for (int j = 0; j < verts.Length; j++)
            newVerts[j] = verts[j];

        newVerts[24] = plane.ClosestPointOnPlane(new Vector3(-2, -1, 0));
        newVerts[25] = plane.ClosestPointOnPlane(new Vector3(2, -1, 0));
        newVerts[26] = plane.ClosestPointOnPlane(new Vector3(-2, 1, 0));
        newVerts[27] = plane.ClosestPointOnPlane(new Vector3(2, 1, 0));

        for (int j = 0; j < tris.Length; j++)
            newTris[j] = tris[j];

        newTris[36] = 24;
        newTris[37] = 26;
        newTris[38] = 25;
        newTris[39] = 26;
        newTris[40] = 27;
        newTris[41] = 25;

        mesh.vertices = newVerts;
        mesh.triangles = newTris;

        meshfilter.mesh = mesh;
    }
}


texts: How can I hide an object for one eye for the unity oculus rift DK2 platform?

texts:
I am trying to build a game for my son for the Oculus Rift DK2 to help treat his lazy eye using Unity.

I need objects that:

Appear only to his left eye
Appear only to his right eye
Appear for both eyes.
(this helps force the brain to use both eyes together to form the complete scene)

How can I pull this off?

Thanks!


texts: How is JS source protected in Chrome games?

texts:
I was playing a space arcade shooter https://moonbreakers.com/ and tried to see some of the JS and shader code. However, I was unable to find anything but some server communication code. Game code is thus probably run on servers, but the shaders should at least be local, right? And I have understood that even if the server runs the true game state, clients commonly do some physics interpolation etc by themselves.

My only guess is that the game gets the code with jQuery and it doesn't show in the page source. Can that code be looked at via a debugger?


texts: How can I upload a pygame that I made on a website?

texts: I'm a beginner programmer and I want to know how can you upload your pygame on websites like coolmathgames or any game websites, do you upload your code after you get a deal with them? do you save it into a file and then upload it through some button? Like how does the whole thing work. Thanks!


texts:
I'm looking for a video encoding library in C++ that I can use to record game footage.

It can not be an external application like Fraps, it must be a library.

Ideally the encoding can be done in real time without affecting game performance too much, although this is not a must have requirement.

Another preference is that the video file being saved from the game is already compressed and ready to be used by most video players without any further processing. I realize that this might not be possible especially for real time encoding, so I would accept a trade off of having to process the file later for better compression and/or better file format.

I'd like to hear about your experience integrating the library into a game if possible and any interesting trade offs you had to make.

Some libraries support more that one file format or codec, so advice on the file format would also be appreciated.


texts:
using UnityEngine;
using UnityEngine.UI;

public class DrawLoad : Graphic
{
    protected override void OnPopulateMesh(VertexHelper vh)
    {
        //==========================
        float r = rectTransform.rect.height / 2.0f;
        //float widthFactor = (rectTransform.rect.width / 2.0f) - r;
        float y = r;
        float x = 0.0f;
        int t = 20;                     // t = total vertices
        float a = 360.0f / (t-1);       // angle delta/differences between each vertex
        float aC = 0.0f;                // incrementing angles  from 0 --> 360
        int maxi = t - 1;
        Vector2[] vtR = new Vector2[t];
        UIVertex[] uivR = new UIVertex[t];

        vh.Clear();

        for (int i = 0; i <= maxi; i++)
        {
            y = r * Mathf.Cos(Mathf.Deg2Rad * aC);
            x = r * Mathf.Sin(Mathf.Deg2Rad * aC);
            vtR[i] = new Vector2(x, y);
            aC += a;

            uivR[i] = UIVertex.simpleVert;
            uivR[i].position = vtR[i];//0,0
            uivR[i].color = Color.green;
            vh.AddVert(uivR[i]);
        }

        // ======== add center point ========
        Vector2 center = new Vector2(0.0f, 0.0f);
        UIVertex c = UIVertex.simpleVert;
        c.position = center;//0,0
        c.color = Color.green;
        vh.AddVert(c);

        for (int i = 0; i <= maxi; i++)
        {
            vh.AddTriangle(t, i, i + 1);// use indexes, don't use count, start from 0
        }

        for (int i = 0; i < uivR.Length; i++)
        {
            uivR[i].color = Color.green;
            vh.SetUIVertex(uivR[i],i);
        }

    }
}

Hi, I wish to change the color dynamically of each assigned triangles.
I have these code modified from Unity documentation and I tried the SetUIVertex method but it doesn't seems to work. What is the proper way to redraw the vertices.
I want to make it in MonoBehavior.Update(). Any helps would be greatly appreciated. Thanks.


texts:
Games like Skyrim, Morrowind, and more are using quads or square to divide the terrain if im correct. The player is always at #5

1 | 2 | 3
4 | 5 | 6
7 | 8 | 9

So whenever you cross the border you unload and load the new "areas" But if the user goes just over the edge and then the second after goes back previous area a lot of unnecessary loading and unloading is done. Is there a general approach to this because I dont think games like skyrim have this issue?

Cheers!


texts:
Yesterday I released my app 'Pic Words' to the windows phone store. It is an Silverlight/XNA app that runs on Windows Phone 7.1 & 8. I have BugSense incorporated into my app. Today I started receiving a lot of crash reports emanating exclusively from the 8.0.10211.0 version of Windows Phone 8. I could not replicate the issue since I do now currently own a Windows 8 phone and the emulator is running OS version 8.0.9903.0, which I don't think can be changed. The error from BugSense is as follows:

XNA Framework Reach profile does not support separate alpha blend. BlendState.ColorDestinationBlend and AlphaDestinationBlend must be set to the same value.

Stack Trace:

at Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ThrowNotSupportedException(String message, Object arg1, Object arg2)
at Microsoft.Xna.Framework.Graphics.BlendState.Bind(GraphicsDevice device)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.set_BlendState(BlendState value)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.SetRenderState()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
at GlobalEngine.Base.SpriteBatchManager.ResumeSpriteBatch()
at GlobalEngine.Base.SpriteBatchManager.Begin(SpriteBatchParams spriteBatchParams)
at GlobalEngine.Base.SpriteBatchManager.Begin(Rectangle scissorArea)
at GlobalEngine.Base.SpriteBatchManager.Begin()
at FourWords.Screens.GameScreen.Draw(Color tint)
at GlobalEngine.ScreenUtils.ScreenManager.Draw(Color tint)
at GlobalEngine.Base.Engine.Draw()
at FourWords.GamePage.OnDraw(Object sender, GameTimerEventArgs e)
at Microsoft.Xna.Framework.GameTimer.RaiseDraw(GameTimerEventArgs gameArgs)
at Microsoft.Xna.Framework.GameDispatcher.RunFrame()
at Microsoft.Xna.Framework.GameDispatcher.OnTick(Object sender, EventArgs e)
at MS.Internal.DirectRendering.OnGameUpdate(Object sender, EventArgs e)
at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)

GlobalEngine is just my library of basic classes like screen management and so on. SpriteBatchManager is a class I created also for managing the spritebatch.

I Begin the spriteBatch with the following parameters:

SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None

Additionally, I manipulate the graphic device as follows in the GamePage.xaml:

protected override void OnNavigatedTo(NavigationEventArgs e){
    // Set the sharing mode of the graphics device to turn on XNA rendering
    SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);
    SharedGraphicsDeviceManager.Current.PreferredBackBufferFormat = SurfaceFormat.Color;
    SharedGraphicsDeviceManager.Current.ApplyChanges();
    //other unrelated code....}

I could not find any help from searching online about this issue and would appreciate any advice on fixing it. Thanks.


texts: Help making a visual transition with pygame and NumPy

texts:
Perhaps this could be better answered on Stack Overflow, but I thought it would be worth posting here. Right now I'm trying to make visual transitions with pygame's surfarray module which uses NumPy. I'm using Cave Story's diamond-checkerboard transitions as a model right now (you can see them in this video http://www.youtube.com/watch?v=mJbAs-sSX4A).

I'm new to NumPy and I'm a little bit over my head. Is there an easy way to accomplish this, or are there any tutorials I should be following? Google brought up a bunch of general NumPy tutorials which I didn't find very helpful for my specific needs.