texts: Making a weapon stay with a first person camera

texts:
I was looking all over the internet for any information on how to get a gun to stay with a camera as done in FPS games.

I am using OpenGL and GLSL to carry this out. I knew a way of how to do this in earlier OpenGL versions, but I could never figure it out in the newer versions.

The type of camera that I am trying to get is something similar to this

With the view matrix and everything else, I should be able to figure out the movement of the hand and the shooting.

Here is some of the code that I have so far:

//Copyright(c) 2019 Ryan Hall All Rights Reserved
//I do not permit any of this code to be used elsewhere by anyone else except me for commercial purposes.
//The gun has two defining variables: one that actually creates the gun and another that moves it around in object space

weaponOfChoice = glm::translate(weaponOfChoice, glm::vec3(camera.GetPosition().x+ 0.15, camera.GetPosition().y - 0.15, camera.GetPosition().z -0.3));

weaponOfChoice = glm::rotate(gun, angle, glm::vec3(0.0f, 1.0f, 0.0f));

weaponOfChoice = glm::scale(gun, glm::vec3(0.005f, 0.005f, 0.005f));

         glUniformMatrix4fv(glGetUniformLocation(shader.Program, "gun"), 1, GL_FALSE, glm::value_ptr(weaponOfChoice));

I have spent quite some time working on how to fix the code so that it will render the gun correctly and have not been able to find any great sources online that will help solve my problem.

How could I do this?

Do I need an identity matrix as used by me in older versions of OpenGL?

If so, how do I create a mimicking function of glLoadIdentity() that will help me with this problem?

Thanks,

-rjhwinner03


texts:
Given a vector (v) for the direction of light and a vector (n) for the normal of a plain.

How can I calculate a rudimentary intensity value (i) where

When (v) points at (n) directly/face on (i) = 1.0
When (v) points away from (n) (i) = 0.0
And everything else in-between

For now we don't need to account for reflection, or any other side effect of a plain.

Has anyone got any ides on how to do this?

I am using DirectX11 for this but I would prefer a solution that I can implement independently.


texts: write to depth buffer while using multiple render targets

texts:
Presently my engine is set up to use deferred shading. My pixel shader output struct is as follows:

struct GBuffer
{
float4 Depth : DEPTH0;      //depth render target
float4 Normal : COLOR0;     //normal render target
float4 Diffuse : COLOR1;    //diffuse render target
float4 Specular : COLOR2;   //specular render target
};

This works fine for flat surfaces, but I'm trying to implement relief mapping which requires me to manually write to the depth buffer to get correct silhouettes. MSDN suggests doing what I'm already doing to output to my depth render target - however, this has no impact on z culling. I think it might be because XNA uses a different depth buffer for every RenderTarget2D. How can I address these depth buffers from the pixel shader?


texts: Why are cube map axes sometimes labelled incorrectly?

texts:
In both 3ds Max (which uses a right-handed coordinate system) and Unity (which uses a left-handed coordinate system), the cube map faces labelled "left" and "right" show the view facing the opposite direction. This is not the case with the front, back, up, or down directions.

In 3ds Max, this is in the context of rendering cube map images from a Reflect/Refract map. In Unity, both cube map textures and skyboxes exhibit the same left/right "confusion". Oddly, however, the GUI labels for cube maps indicate that left is the -X direction and right is the +X direction - which is correct in Unity - while skyboxes indicate the opposite (all other axial labels are consistent between the two).

The upshot of this is that cube map images rendered by 3ds Max (which each have a suffix indicating their viewing direction) can be assigned to the texture slots in Unity with the same name and everything will work, but only because both programs label the left view as "right" and vice versa.

The only discussion of this I was able to find online was in a blog post on floored.com (search for "Unity Skybox Weirdness" and it should come up; I'd post a link but I lack sufficient reputation to include more than two). Here's an image from the post that illustrates the issue:

Is there a reason why the left/right axes of cube maps are mislabelled in both of these programs? Although it's trivial to ignore once you're aware of it, it seems like there should be a good (or at least historical) explanation for it, unless it's simply a case of a long-overlooked bug in 3ds Max that the Unity developers decided to accommodate.

Any thoughts would be appreciated!


texts: How to store level data in a libgdx game if implementing ECS pattern

texts:
I am writing a beat'em up like game in Libgdx while following the ECS pattern brought up by ashley. For setting up the stage, I am using TileMap and Tiled. An object layer for collisions, and a tile layer for the tiles. Usually, an entity -in this case, an enemy- has a lot of components so harcoding one class for each stage on start up is out of the box. I have already considered this options:

SQLite database. Seems rather complex for the task, somehow.
Json files. I'd have to overwrite and create my own serialization class
Using another object layer for spawning enemies by using the "Custom attributes" option in order to store extra data.

Have anyone come up with a similar problem or experience already? What would be the best approach?


texts: Why am I getting these errors when including stb_image.h?

texts:
I'm trying to put an include guard around including stb_image.h (from the well-known public domain image library).

I have noticed that, unusually, the include guard works inside the .cpp file but not inside the header file.

Let me explain:
Inside texture.h:

//This is something that stb image defines in its own include guard, so I should be able to test for it
#ifndef STBI_INCLUDE_STB_IMAGE_H
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif

This gives me errors (multiple definitions of everything inside stb_image.h), but the same code in Texture.cpp does not give me an error.

Also, I'd like to note that this does not work either:

#ifndef WHOMST
#define WHOMST
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif


texts:
I have code that I'm trying to update from DirectX 8, and so far I have been doing just fine until I reached this line of code:

r = g_pDevice->GetBackBuffer(/*,*/ 0, D3DBACKBUFFER_TYPE_MONO, &pBackSurf);

Because of this I decided to look up the changes that were made between DirectX 8 and DirectX 9 regarding GetBackBuffer, and found that it needed a parameter called iSwapChain. What it's asking for is the swap chain ordinal value, and referred me to D3DCAPS9's code - more specifically the Number of Adapters in Group variable.

Of course I want to have the correct value to correspond with whatever ordinal would give me the proper backsurface to write stuff to (i.e. the last-to-render backsurface in the chain) but that information is elusive and when I was guided to DCAP.NoAiG it doesn't lead me anywhere else.

How do I get the proper swapchain enumeration for getting the backbuffer?


texts: How to limit click'n'drag movement to an area?

texts:
I apologize for the somewhat generic title. I'm really don't have much clue about how to accomplish what I'm trying to do, which is making it harder even to research a possible solution.

I'm trying to implement a path marker of sorts (maybe there's a most suitable name for it, but this is the best I could come up with).

In front of the player there will be a path marker, which will determine how the player will move once he finishes planning his turn. The player may click and drag the marker to the position they choose, but the marker can only be moved within a defined working area (the gray bit).

So I'm now stuck with two problems:

First of all, how exactly should I define that workable area? I can imagine maybe two vectors that have the player as a starting point to form the workable angle, and maybe those two arcs could come from circles that have their center where the player is, but I definetly don't know how to put this all together.

And secondly, after I've defined the area where the marker can be placed, how can I enforce that the marker should only stay within that area? For example, if the player clicks and drags the marker around, it may move freely within the working area, but must not leave the boundaries of the area. So for example, if the player starts dragging the marker upwards, it will move upwards until it hits he end of the working area (first diagram below), but if after that the player starts dragging sideways, the marker must follow the drag while still within the area (second diagram below).

I hope this wasn't all too confusing. Thanks, guys.

Edit: In case this makes a difference, I'm using C++ with Marmalade SDK.


texts:
This might be very basic, but I couldn't find something relevant to what I need (see below). I am working on a very basic thing: a 3D environment with some buildings, and actors walking inside it. It looks like following:

I mainly want to manage to have one actor standing around, idling, and another walking around the area. Right now, this is done through matinee + skeletal mesh groups, and forcing a looped animation on the actors:

But I realize this is super caveman-level. So I've build an AnimTree, linking the idling and directional animations to the corresponding nodes. But then, I'm stuck. I added the AnimTree in the actors properties, but nothing happens. I've tried MoveToActor, but no success - is there a thing to set to allow an actor to move? Also, I place the actors on the map manually (they are supposed to be unique), should I spawn them instead?

Every tutorial I find explains how to use an AnimTree for the player character, which is not what I want. I need a way to move the actors. I tried to look for AI tutorials, but only found UT3 bots-modifications, which is not what I need either.

Since I have so much trouble finding how to do this through Kismet, I'm starting to suspect this has to be done through scripting/coding, but I would like to be sure there is no way to do it through Kismet before going that route.

Every bit of answer about how to tell an actor something along the lines of "go in that direction as much as you can, then when you hit a wall turn 45° and continue" would be awesome.

I'll be happy to move/edit the question if there is any problem with it


texts: Why do games for Facebook have to be about 622 pixels high?

texts: I am wondering, why do games for Facebook have to be about 622 pixels high?


texts:
If  you check Quake 1 source code (sys_linux.c), you can see something like this:

double          time, oldtime, newtime;

double Sys_FloatTime (void)
{
  struct timeval tp;
  struct timezone tzp;
  static int      secbase; // new epoch

  gettimeofday(&tp, &tzp);

  if (!secbase)
  {
    secbase = tp.tv_sec;
    return tp.tv_usec/1000000.0;
  }

  return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
}

while (1)
{
  // find time spent rendering last frame
  newtime = Sys_FloatTime ();
  time = newtime - oldtime;

  if (time > sys_ticrate.value*2) // 50 ms * 2
    oldtime = newtime;
  else
    oldtime += time;

  Host_Frame (time);
}

Why does Quake do = some time and += at other times? I suppose it must be some floating point issue, but Sys_FloatTime() returns a double, which is very accurate. It is also adjusted to return seconds from the start of the program, it doesn't count from 1/1/1970. Changing the code to use assignment at all times, doesn't seem to change anything.

EDIT: If you check QW source code, you will see, that Sys_FloatTime() is renamed to Sys_DoubleTime(). But even if a float was returned, why would using += vs = make any difference? IMO, ever using a float for something like this was wrong, plain and simple.


texts: What C++ containers should I use for my UI elements?

texts: I am writing some UI stuff for my games in C++. Basically its a very common problem, but I dont know the best answer yet. Suppose inside my UI Library I have a view class which renders 2D/3D scene. This view can contain many subviews. I needs a container which allows me to iterate over these views fast and also insert/delete subviews. I am not sure which container is best for the job - list, vector or something else?


texts: Perlin noise example the same on CPU as GPU?

texts:
I am looking for an example site with a Perlin Noise implementation in both CPU and GPU, that generates somewhat the same results in those two places.

I see many CPU implementations of Perlin Noise, but they don't match up with the GPU implementations that I found.

The reason I need this is for physics. The map is generated with Perlin Noise on the GPU in 2D, but this also means that to do physics, I must have a CPU version of the algorithm that generates the same results.


texts:
I have a hexagon in the Polygon node I would like to rotate so the pointy side is upwards. Applying the rotation nodes, however, simply changes the color of the hexagon from white to a color in the rainbow.
What does the Vector1 of the Polygon output represent and is there a way I can rotate it as if it were a texture?


texts: Computing Normals for a displaced material

texts:
Disclosure: cross-posted on Unreal Answers, thought was sufficiently general for GameDev.SE

I am currently rendering a displacement texture and, separately, a normal texture for my ocean. Is there a clever way where I can actually just compute the normal in the final material. I.E. the un-displaced normal is (0, 0, 1) then by using perhaps ddx/ddy work out the real normal? It seems like this question is trying a similar thing. I don't really understand the ddx/ddy nodes/functions but they seem at least related.

Using the ddx, ddy nodes what I tried was computing for each given point:

dx = ddx(WorldPosition.x)
dy = ddy(WorldPosition.y)
dz/dx = ddx(height) / dx
dz/dy = ddy(height) / dy

Then I used these values to rotate my base normal of (0, 0, 1) to the final normal. It kinda looks like I'm on the right track but I not 100% calculation at a couple of points. Further, it isn't quite right as the normal appears to change as I move the camera around (using the world normal buffer visualisation).

Calculation:

let Tan(theta) = dz / dx
let Tan(phi) = dz / dy

Then plugging these values into the rotation matrix R_theta, R_phi:

\$R_\theta=\begin{pmatrix}
1 & 0 & 0 \\
0 & cos(\theta) & -sin(\theta) \\
0 & sin(\theta) & cos(\theta) \\
\end{pmatrix}
R_\phi=\begin{pmatrix}
cos(\phi) & 0 & sin(\phi) \\
0 & 1 & 0 \\
-sin(\phi) & 0 & cos(\phi) \\
\end{pmatrix}\$

I compute theta and phi by applying atan to dz/dx and dz/dy respectively.
Finally multiplying R_thea * R_phi * n to get:

sin(phi)
-sin(theta)cos(phi)
cos(theta)cos(phi)

Is what I am trying to do possible and what am I doing wrong? Specifically:

Am I using the ddx, ddy nodes correctly to compute the change in height over x and y
How come the normal appears to change as I move the camera
Does the fact there is horizontal displacement in my ocean matter


texts: Create a website that lists all the game servers from a country

texts:
I have seen some sites which shows servers(for online games) from various parts of world with there name and ip's. I am looking forward to develop something of same sort.

But the issue is how to get all the IP's of servers playing a certain game. Is there any criteria for the same. For eg: I want to list all online servers from US which are playing Counter Strike and also to get the players in it and other info.


texts:
In my rhythm game, I have a note object which can be of a different color depending on the note chart. I could use a sprite sheet with all the different color variations I use, but I would prefer to parametrize this.
(Each note sprite is made of different shades of a hue. For example a red note has only red, light red and dark red.)

How can I colourise a sprite anew?

I'm working with OpenGL, but any algorithm or math explanation will do. :)


texts: How can I unify the collision handling of melee/spell attacks in a networked environment?

texts:
I am trying to figure a good way to create the battle system of a game. The game is fast paced and the gameplay needs to be precise (think hack n slash)

What I would like to achieve is a simple and unified system that could manage any type of attacks, that could be tweaked.

My first idea is to use physics shape: For example an arrow will just be a little capsule moving forward, an explosion would be a growing sphere collider, and melee combat could be done by spawning a box in front of the player.

One problem I have with this is that I'd like to have an authoritative server for multiplayer, which means I shouldn't use too much actual physics.

So, is there any standard way people program these sort of systems, do you know any good starting point better than just using physics?


texts:
This will be a quick question since Im pretty sure I'm overlooking something small that I for some reason cant see.

My sprite is moved using a joystick, and I want my sprite to be able to shoot. I've got the direction and speed of my bullet working, but I cannot get it to shoot from the right place (my sprites location).

Code for moving sprite:

    angle = Math.atan2(touchingPoint.y - inity,
                touchingPoint.x - initx) / (Math.PI / 180);

        pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (touchingPoint.y / 90); //Sprites y-position
        pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (touchingPoint.y / 90); //Sprites x-position

Current code for moving bullet:

    if(shooting){
        bulletPos.y += Math.sin(angle * (Math.PI / 180)) * 2;
        bulletPos.x += Math.cos(angle * (Math.PI / 180)) * 2;
    }

Since the angle is calculated using constants I get why my bullet only spawns at one place, even tho Im moving my sprite around. My question is, how do I fix this?

First time working with vectors like this and all I can find on stack is logic for tower-defence games, if there is a duplicate of this question I apologise but really cannot find it.


texts:
No matter how I experiment with RasterizerState Depth Values, I always get a detached shadow which is called peter panning. Ive even adjusted the near plane for the light camera. It always seems to stay at that certain distance. I can get it no closer.

I was wondering on some insight on what the fix could be.
Below is the shader code I use when rendering the depth map which has the BIAS values.
   cbuffer cbPerObject
{
    float4x4 gWorldViewProj;
};

struct VertexIn
{
    float3 PosL    : POSITION;
};

struct VertexOut
{
    float4 PosH    : SV_POSITION;

};

VertexOut VS(VertexIn vin)
{
    VertexOut vout;

    vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);

    return vout;
}
RasterizerState Depth
{

    DepthBias = 85000;
    DepthBiasClamp = 0.0f;
    SlopeScaledDepthBias = 10;
};

technique11 Light2Tex
{
    pass P0
    {
        SetVertexShader(CompileShader(vs_5_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(NULL);

        SetRasterizerState(Depth);
    }
}


texts: What counts as a successful ad view in a mobile app?

texts:
There is one thing about mobile ads that I can't completely understand.
Let's say I put ads in my free mobile game. What counts as a successful ad view? When it is just displayed on a user's screen or the user has to open the ad in order for it to count as viewed?


texts: How Should I Go About Updating My XNA Game?

texts:
So, I've created an XNA game, but I'm not selling it... it's just a private game to give away to my friends, more of a practice project. But say I find a bug, or think of a new feature...

I don't want to have to resend the file to them every time an update comes out. That'd be too many people to send it to. How should I go about this issue?

If this question is a duplicate, please tell me, or if there's a Web page with this answer that I missed, also tell me.

Thanks in advace!


texts: How do I refer to the two types of loading screen?

texts:
I'm troubleshooting some issues beyond the scope of this forum, and I'd like to be able to talk about certain parts of the gaming experience, specifically the two types of loading screen I see in Prey.
Both are shown in this short video I made.
The first type with the loading bar is what I usually think of as the "loading screen", but what do I call the second "loading screen" that happens right after with the moving squares in the bottom-right? To be clear, I'd like a term to be used with non-game-devs.


texts: How can I convey to a player that they need to hold the screen?

texts:
My game has similar mechanics as Flappy Bird game. When you tap or hold the screen with your finger, character goes up. Everybody who tested the game forgot to hold touching the screen, instead they played it only tapping the screen which made some parts of the game difficult to pass.

I want to display a tutorial at the beginning of the game. English is not my native language so I am a little bit confused. Which message is grammatically correct?

Hold the screen to fly

or

Hold on to the screen to fly

or

Hold your finger on the screen to fly

If anybody displayed a similar message in their game, can you share it with me?


texts:
Before i write my own asp.net app, i wanted to see if there is an existing service already.
What i am looking for is send # of zombies the player killed at the end of game to the service. The service than shows sum of all zombies killed that day in the world by other players.
It will also show top 3 players by their summed score today, not their best score in one game.
Is there such service available or do i have to roll out my own?
thanks

Moderator marked this as duplicate of this but the service mentioned in the topic is no longer in service.


texts:
I am trying to make a simple tooltip for my game. I added event trigger to object that I want to trigger an event on mouse hover (PointerEnter).

And I want to get the game object that triggered the event in ShowTooltip(). I tried requiring BaseEventData in the void but it gave me error.

void ShowTooltip(BaseEventData baseEvent)
{
    Debug.Log(baseEvent.selectedObject.name);
}

The error: Failed to call function ShowTooltip of class UIManager

Calling function ShowTooltip with no parameters but the function requires 1.


texts: Wall detection in maze game - On the fly or precomputed?

texts:
I've been a programmer for over a decade, professionally for the last five years, but I've never really done any games programming. I've had a look at some tutorials but most of what I've found is geared towards people with no programming experience, so I've tended to get bored and moved on. So, after grasping the basics of the game loop, I've decided to dive right in.

As my first project I am programming a basic 2D top down maze game (a Pac Man clone). I've got all the basics working fine, and am now thinking about optimizations. I have an idea to improve the performance of my wall collision detection but I'm interested to know the 'proper' way of doing it.

At the moment my algorithm is basically:

Check direction player wants to move in
Loop through all walls and see if any are at that position
If there are no walls, move the player

This is working fine, but I imagine if I scale it up that the act of looping through all the walls each time will become an issue. Due to the simplicity of the game and the speed of modern computers, it might not ever be noticeable, but I'd rather be using the cycles for something else.

So it occurs to me that as this data is never changing, I could just build a lookup table as part of my map creation within my level editor. I've heard about similar things being done for more complex 3D games. I would then have a lookup table that stored each possible player position, each possible direction, and whether the player can move there. This means that on each move, I can just do a quick check to the lookup table to see if the move is possible, rather than repeatedly looping through a load of static data every single frame.

Is this a common thing to do? Or are neither of these approaches any use, in which case what is the best way to handle this?


texts:
I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them.

The line itself is a 3d object which is scaled to match the length between points. Currently you can draw lines that are horizontal or vertical. But drawing a line that starts and ends on a different level fail.

Horizontal and vertical work well.

Here the lines should go like indicated by the grey lines. But it adds the Z-rotation(Up/down) to the Y-rotation(direction) - (Setting the Y-rotation by hand to match the horizontal line results the line being drawn correctly).

            Vector3 dir = junctionFinderHit.transform.position - startPos;  /// Direction vector
            float angleY = Vector3.Angle(dir, new Vector3(1, 0, 0));
            float angleZ = Vector3.Angle(dir, new Vector3(0, 1, 0));

            //Debug.Log(angleY + " - " + AngleDir(new Vector3(0, 1, 0), dir, Vector3.up));

            Vector3 rotationVector = new Vector3(0,0,0);

            if (AngleDir(new Vector3(1, 0, 0), dir, Vector3.up) < 0)    /// 360 movement instead of 180
                rotationVector.y = 360-angleY;
            else
                rotationVector.y = angleY;

            /// -90 degrees to make it horizontal by default, negative to make it point to the right direction
            rotationVector.z = (angleZ-90f)*-1;

            activeStick.transform.eulerAngles = rotationVector;

What do I need to do to get the rotations correct?


texts: Ray tracing - draw polygon (square/bounded plane)

texts:
I'm going on with my own ray tracer as an iPad app for a school project. This is the result with soft shadow, antialiasing, pure reflective and pure transparent object:

Now i want to change the skybox, implemented with the method contained here http://www.ics.uci.edu/~gopi/CS211B/RayTracing%20tutorial.pdf with a real cube that wrap all the scene. In this way I can display the soft shadow projected on the floor.
I read a lot of documentation about ray tracing polygon and I understood how to check if the ray intersect the polygon plane. Now my question is: if I want to draw a square, one for each side of my cube that will wrap the scene, how do I check if the point of intersecton is inside the square/polygon (so that i can shade it)? All the documentation seems so vague and incomplete. I can't find a complete explanation with some example, and maybe with some pseudo code, that really explain how to draw a square (bounded plane) in a ray tracer.

Thanks for helping me.


texts: Unreal MouseWheelAxis negative axis does not work

texts:
Would like to avoid using separate action mappings i.e. MouseWheelUp and MouseWheelDown for a system I'm developing.

I noticed MouseWheelAxis and put that as my axis event. This only works on the forward movement of the mouse wheel, and not on the backwards, as stated. (presumably because the scale is set to +1.0)

Why?

And how can I get around this?


texts: Generating grammatically correct MUD-style attack descriptions

texts:
I am currently working on a text based game, where the outcome of a combat round goes something like this

%attacker% inflicts a serious wound (12 points damage) on %defender%

Right now, I just swap %attacker% with the name of the attacker, and %defender% for the name of the defender. However, the description works, but don't read correctly. Since the game is just all text, I don't want to resort to generic descriptions (Such as "You use Attack on Goblin for 5 damage", which arguably solve the problem)

How do I generate correct descriptions for cases where %attacker% refers to

"You", the player? "You inflicts..." is wrong
"Bees", or other plural? I need somehow to know I should prefix the name with a "The "
If %attacker% is a generic noun, such as "Goblin", it will read weird as opposed to %attacker% being a name. Compare "Goblin inflicts..." vs. "Aldraic Swordbringer inflicts...."

How does text-based games usually resolve such issues?


texts: How do I represent a 3D world-based game in a 2D Platformer/Top-Down gameview?

texts:
To imagine the question lets have the following scenario:

  We have Terraria (a 2D Platformer revolving around harvesting
  resources and building stuff). We have a large 3D sphere populated
  with resources (static) and creatures (dynamic and reactive). If the
  world of Terraria was 3D instead of linear 2D (with 3 layers in the
  3rd dimension in total), what are the different ways one could deliver
  the visualization of such a world/game?

The example I have given above is for a 2D Platformer based on a 3D world. For the above case - the question is easily solved somewhat by converting the 2D platformer into a top-down planar game (Civ V to a limited extent - again represents a cylinder not a sphere; Rimworld nails the top-down solution almost perfectly, but some rasterization using tiles was required)  - but lets avoid that and explore some better options.

Another example I would like to give for a top-down 2D planar game based in a 3D space:

  We have a classic Top-Down space invader shooter, in this case, space
  is completely flat and planar - with limited depth in the 3rd
  dimension. What if the depth was infinite in the 3rd Dimension? What
  if the dimensionality of battles in realistic 3D space games were more accurately
  simulated instead (attacks arriving from multiple dimensions - and not
  just the same plane)? Ofcourse, keeping the 2d concept of the
  visualization itself in mind. What are the different ways to make this
  possible?

And also, is it even practical?

This is not easily solved by turning the UI into a platformer. Homeworld tackles this only to a certain extent - but it still limits the depth and reduces the significance of the 3rd Dimension.


texts: Node.js MMO - process and/or map division

texts:
I am in the phase of designing a mmo browser based game (certainly not massive, but all connected players are in the same universe), and I am struggling with finding a good solution to the problem of distributing players across processes.
I'm using node.js with socket.io.
I have read this helpful article, but I would like some advice since I am also concerned with different processes.
Solution 1:
Tie a process to a map location (like a map-cell), connect players to the process corresponding to their location. When a player performs an action, transmit it to all other players in this process. When a player moves away, he will eventually have to connect to another process (automatically).
Pros:

Easier to implement

Cons:

Must divide map into zones
Player reconnection when moving into a different zone is probably annoying
If one zone/process is always busy (has players in it), it doesn't really load-balance, unless I split the zone which may not be always viable
There shouldn't be any visible borders

Solution 1b:
Same as 1, but connect processes of bordering cells, so that players on the other side of the border are visible and such. Maybe even let them interact.
Solution 2:
Spawn processes on demand, unrelated to a location. Have one special process to keep track of all connected player handles, their location, and the process they're connected to. Then when a player performs an action, the process finds all other nearby players (from the special player-process-location tracking node), and instructs their matching processes to relay the action.
Pros:

Easy load balancing: spawn more processes
Avoids player reconnecting / borders between zones

Cons:

Harder to implement and test
Additional steps of finding players, and relaying event/action to another process
If the player-location-process tracking process fails, all other fail too

I would like to hear if I'm missing something, or completely off track.


texts:
Basically, for our college project, we need to use a font in xna. The only problem is that we are not allowed to install it due to admin rights.

Is it possible to use and load the .xnb file that gets created as the font. Using spritefont gives errors as it searches for the font in windows.

(The .xnb file will be created on someones personal machine beforehand.)


texts:
My specific area of interest is designing the AI of real-time multiplayer games, for example, RTS games. Moves by players happen simultaneously, so I was wondering whether or not it would be modeled with a sequential (extensive form) game tree or something else. I don't know if this is even the correct approach at all, and if some other algorithms are more applicable.

How much of Artificial Intelligence design is based off of game trees or extensive-form games, and are there any suggested textbooks which thoroughly cover the subject game tree application to AI or AI of RTS games?


texts:
I know JavaSound API like this:

audioInputStream = AudioSystem.getAudioInputStream(file);
AudioFormat audioFormat = audioInputStream.getFormat();
DataLine.Info info = new Info(SourceDataLine.class, audioFormat);
sourceDataLine = (SourceDataLine) AudioSystem.getLine(info);
sourceDataLine.open();
sourceDataLine.start();
floatVoiceControl.setValue(-20);
byte[] buf = new byte[0xFF];
int onceReadDataSize = 0;

While file is the File object.

But when I tried to play some very small audio very frequently (say, the audio played when a small enemy is killed), it blocks my main thread and make the game very slow.
Is there any alternative or workarounds? I prefer something inside the Java's standard library, since I'm developing a game engine based on Swing.


texts: Can I create custom framebuffer and render to it in cocos2dx?

texts:
I want to do post processing effects so I was thinking If I could just make custom framebuffer in cocos2dx like OpenGL and render the ALL SCENES objects in it. I want a single frame buffer for all scenes. Is there any
 way? Thanks.


texts: I'm always looking for ways to improve the smoothness of my games.  When I read around the net I come across the term "vsynched" quite often.  What does vsynched mean?


texts: Why the rotation switching mode is not working right when using bools?

texts:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Objects : MonoBehaviour
{
    public float maxScale = 10.0f;
    public float minScale = 2.0f;
    public float shrinkSpeed = 1.0f;
    public float rotatingSpeed = 3f;
    public bool automaticScale = false;
    public bool rotateOnMouseMove = false;
    public bool rotateOnMouseDrag = true;

    private float targetScale;
    private Vector3 v3Scale;

    void Start()
    {
        v3Scale = transform.localScale;
    }

    void Update()
    {
        RaycastHit hit;
        Ray ray;

        if (Input.GetMouseButton(1))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit) && hit.transform == transform)
            {
                targetScale = minScale;
                v3Scale = new Vector3(targetScale, targetScale, targetScale);
            }

            if (automaticScale == false)
                transform.localScale = Vector3.Lerp(transform.localScale, v3Scale, Time.deltaTime * shrinkSpeed);
        }

        if (Input.GetMouseButton(0))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit) && hit.transform == transform)
            {
                targetScale = maxScale;
                v3Scale = new Vector3(targetScale, targetScale, targetScale);
            }

            if (automaticScale == false)
                transform.localScale = Vector3.Lerp(transform.localScale, v3Scale, Time.deltaTime * shrinkSpeed);
        }

        if (automaticScale == true)
        {
            transform.localScale = Vector3.Lerp(transform.localScale, v3Scale, Time.deltaTime * shrinkSpeed);
        }

        if (rotateOnMouseMove == true)
        {
            transform.Rotate(Input.GetAxis("Mouse Y") * rotatingSpeed, -Input.GetAxis("Mouse X") * rotatingSpeed, 0, Space.World);
        }

        if (rotateOnMouseMove == true)
        {
            rotateOnMouseDrag = false;
        }

        if (rotateOnMouseDrag == true)
        {
            rotateOnMouseMove = false;
        }
    }

    private void OnMouseDrag()
    {
        if (rotateOnMouseDrag == true)
        {
            transform.Rotate(Input.GetAxis("Mouse Y") * rotatingSpeed, -Input.GetAxis("Mouse X") * rotatingSpeed, 0, Space.World);
        }
    }
}

The problem is at the bottom:

if (rotateOnMouseMove == true)
            {
                rotateOnMouseDrag = false;
            }

            if (rotateOnMouseDrag == true)
            {
                rotateOnMouseMove = false;
            }

Once I'm starting the game by default the rotateOnMouseDrag is set to true.
When I click on the check box of rotateOnMoseMove it's switching between them the rotateOnMouseDrag is false and rotateOnMouseMove is true.

The problem is when then I click again on the check box of rotateOnMouseDrag but it's never switching between them again it keep staying true on the rotateOnMouseMove.

I want it to act like a switch each time one of them is true the other should be false.


texts: Pathfinder is making my NPC follow my oldest position only

texts:
I am trying to make a maze/horror game. I used an online template in the Roblox library as my enemy. I used pathfinder as you will see in the code below. It's finding me like it's supposed to, except it only goes for my LAST position. As you can see in the image below, it completely skipped me, went to my LAST position, then started chasing me. I don't know why it only goes for my last position, and not my current position.
local PathFindingS = game:GetService("PathfindingService")
local humanoid = script.Parent:WaitForChild("Humanoid")
local rootPart = script.Parent:WaitForChild("HumanoidRootPart")
local Players = game:GetService("Players")
game.Workspace.Fruity.Humanoid.WalkSpeed = 60

--To calculate the path
while wait() do

    for i, player in pairs(game.Players:GetPlayers()) do
        local character = game.Workspace:WaitForChild(player.Name)
        local characterPos = character.PrimaryPart.Position
        local path = PathFindingS:CreatePath()
        path:ComputeAsync(rootPart.Position, characterPos)
        game.Workspace.Fruity.HumanoidRootPart:SetNetworkOwner(nil)

        local waypoints = path:GetWaypoints()

        for i, waypoint in pairs(waypoints) do
            local part = Instance.new("Part")
            part.Shape = "Ball"
            part.Material = "Neon"
            part.Size = Vector3.new(0.6,0.6,0.6)
            part.Position = waypoint.Position + Vector3.new(0,2,0)
            part.Anchored = true
            part.CanCollide = false
            part.Parent = game.Workspace
            humanoid:MoveTo(waypoint.Position)
            humanoid.MoveToFinished:Wait()
        end
    end
end


texts: How do I implement variation in font letters, like handwriting?

texts:
I can use a sprite sheet to automatically use a custom font. What I'd like to do though is to have several versions of each letter, such that the letters can be varied and more natural looking (a la handwriting). I don't know precisely how fonts are internally implemented, but I assume there's some function mapping chars to images. It seems like if that function isn't sealed, it wouldn't be difficult to make that function randomly choose one of "equal" images (that have slight variations).

Anyone know the plausibility of this/what code I'd want to overload to make this work with existing font infrastructure in xna?


texts: Unity: transform.LookAt(target) not "looking at" target?

texts:
I have been troubleshooting a prefab for several hours and am out of ideas. It concerns a method that I thought I was comfortable with, transform.LookAt(target).  I have this prefab:

As you can see, I verified that the registration points for the eyes are at the center of mass; I also verified that they rotate correctly for the X, Y and Z axes. That yellow ball you see is the target object and IS NOT inside the prefab.

I have tried two means to get the eyes to look at the target. The first is this script, and it caused the eyes to dart 90 degrees counter-clockwise about the y axis (which is very wrong). I applied this script to both eyes. Check it out:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookAt : MonoBehaviour
{
    public Transform target = null;

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(target);
    }
}

And please, before you think it: Yes, I remembered to set the target object in the editor. You can see the eyes pointing to the side instead of the target:

I found this other script on the Unity documentation that didn't work at first, but then I changed "Rotation" to "LocalRotation", saw that I was close, reversed the "relativePos" vector, and it worked--but only about the y axis:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookAt : MonoBehaviour
{
    public Transform target = null;

    // Update is called once per frame
    void Update()
    {
        Vector3 relativePos = transform.position - target.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, Vector3.up;
        transform.localRotation = rotation;

    }
}

You can see here that it works in the XY plane at eye level, but take my word for it when I say the eyes cannot look up or down if I move the ball up or down:

How can I fix this so that the eyes always look at the target I need it to?
Thank you sincerely for your time.

EDIT: I fixed it by this sloppy additional rotation, but there has to be a better way:

void Update()
    {
        //transform.LookAt(target);

        Vector3 relativePos =  target.position - transform.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, new Vector3(0,1,0));
        transform.rotation = rotation*Quaternion.Euler(0,90,0);
    }


texts: Is Jump Point Search (A* with JPS) appliable to non-diagonal grids?

texts:
I'm trying to speed up my pathfinding and discovered A* with JPS. It basically prunes tiles before adding them to the OPEN set.

Can I use that technique with my grid that only allows straight directions?


texts:
Let say I have this list and currently there are three animals inside the list.
These names below are displayed on the text field in the scene.

Cat

Bird

Goat

If there is a new animal is added to the list, for example a 'dog',
the code will add 'dog' below the 'Goat' inside the text field above.
Now I have a problem when the same animal is added to the list. I don't know how to actually display the updated text field if the same type of animal is added to the list and will not messing up the text field or duplicating the same name inside the text field. Please help.

This is the code

foreach (var animalnames in newComp)
        {
            if((componentName.text.Length !=0)&&(animal.transform.name != animalnames.name))
            {
                componentName.text = oldName+('\n')+('\n')+('\n')+animal.transform.name;
            }
            if((componentName.text.Length !=0)&&(animal.transform.name == animalnames.name))
            {
                Debug.Log("same");
                animalnames.name = animal.transform.name;
                //componentName.text = ('\n')+animalnames.name;
            }
        }
        oldName = componentName.text;


texts: How does the Path of Exile ItemRenderer determine the items' rarity?

texts:
This question is really specific to Path of Exile and their forum.

Basically, they render the items from a json object.

require(["PoE/Item/DeferredItemRenderer"], function(R) { (new R(JSON)) })

And the json of an item is of the form:

      {
         "verified":true,
         "w":1,
         "h":1,
         "icon":"http:\/\/webcdn.pathofexile.com\/image\/Art\/2DItems\/Rings\/Ring5.png?v=d645f9adfc012c52674c94d16b4292b2",
         "support":true,
         "league":"Default",
         "sockets":[

         ],
         "name":"Honour Grip",
         "typeLine":"Topaz Ring",
         "identified":true,
         "requirements":[
            {
               "name":"Level",
               "values":[
                  [
                     "41",
                     0
                  ]
               ],
               "displayMode":0
            }
         ],
         "implicitMods":[
            "+22% to Lightning Resistance"
         ],
         "explicitMods":[
            "Adds 4-48 Lightning Damage",
            "+8 to Evasion Rating",
            "+70 to maximum Life",
            "+35% to Cold Resistance"
         ],
         "frameType":2,
         "socketedItems":[

         ]
      }

I don't see the rarity of the item anywhere... How do you think they determine it? They could count the mods, but what if the object is not identified?


texts: How do I draw a single Triangle with XNA and fill it with a Texture?

texts:
I'm trying to wrap my head around:

http://msdn.microsoft.com/en-us/library/bb196409.aspx

I'm trying to create a method in XNA that renders a single Triangle, then later make a method that takes a list of Triangles and renders them also. But it isn't working. I'm not understanding what all the things does and there's not enough information.

My methods:

// Triangle is a struct with A, B, C (didn't include) A, B, C = Vector3

public static void Render(GraphicsDevice device, List<Triangle> triangles, Texture2D texture)
{
    foreach (Triangle triangle in triangles)
    {
        Render(device, triangle, texture);
    }
}

public static void Render(GraphicsDevice device, Triangle triangle, Texture2D texture)
{
    BasicEffect _effect = new BasicEffect(device);
    _effect.Texture = texture;
    _effect.VertexColorEnabled = true;

    VertexPositionColor[] _vertices = new VertexPositionColor[3];

    _vertices[0].Position = triangle.A;
    _vertices[1].Position = triangle.B;
    _vertices[2].Position = triangle.B;

    foreach (var pass in _effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        device.DrawUserIndexedPrimitives<VertexPositionColor>
        (
            PrimitiveType.TriangleList,
            _vertices,
            0,
            _vertices.Length,
            new int[] { 0, 1, 2 }, // example has something similiar, no idea what this is
            0,
            3 // 3 = gives me an error, 1 = works but no results
        );
    }

}

Now my method looks like this, according to your recommendations:

    public static void Render(GraphicsDevice device, Triangle triangle, Color color)
    {
        BasicEffect _effect = new BasicEffect(device);
        _effect.Texture = ColorToTexture(device, color, 1, 1);
        _effect.TextureEnabled = true;
        //_effect.VertexColorEnabled = true;

        VertexPositionTexture[] _vertices = new VertexPositionTexture[3];

        _vertices[0].Position = triangle.A;
        _vertices[1].Position = triangle.B;
        _vertices[2].Position = triangle.C;

        foreach (var pass in _effect.CurrentTechnique.Passes)
        {
            pass.Apply();

            device.DrawUserIndexedPrimitives<VertexPositionTexture>
            (
                PrimitiveType.TriangleStrip, // same result with TriangleList
                _vertices,
                0,
                _vertices.Length,
                new int[] { 0, 1, 2 },
                0,
                1
            );
        }

    }

and my method that creates a texture from color (tried this with single spriteBatch.Draw() = works)

    public static Texture2D ColorToTexture(GraphicsDevice device, Color color, int width, int height)
    {
        Texture2D texture = new Texture2D(device, 1, 1);
        texture.SetData<Color>(new Microsoft.Xna.Framework.Color[] { color });

        return texture;
    }

and in my Draw method in Main Game:

Render(GraphicsDevice, new Triangle(new Vector3(50, 50, 0), new Vector3(100, 100, 0), new Vector3(150, 50, 0)), Color.Green);

= no triangle on screen.


texts: What is the physics behind a 2D gravity tunnel?

texts:
In Portal 2, there is a concept of an "excursion funnel", a beam of light that moves physical objects in a certain direction.

Here is a link to a demonstration.

I added a simple implementation that lets me float upward against gravity (I can't give you an example I've tried as I've lost it due to the undo buffer size being too small), however I've been having a struggle generalizing it to work with any angle.

My code so far:

// on funnel collision with body:
    body->SetGravityScale(0);

// on each update, for each body that is in collision:
    float s = sin(this->body->GetAngle()), c = cos(this->body->GetAngle());

    b2Vec2 force = {body->GetWorld()->GetGravity().x * -s * 2.f, body->GetWorld()->GetGravity().y * -c * 2.f};
    for(ServerEnt* e : collidingWith) {
        e->body->ApplyForceToCenter(e->body->GetMass() * force, true);
    }

// on funnel end collision with body:
    body->SetGravityScale(1);

This almost works, except Portal 2 funnels don't let objects fall through it, they sort of push the objects toward the center of the nearest cross-section of the funnel, which is where my code fails, or rather doesn't do anything about.


texts: How to implement scene changing in real-time?

texts:
I want to implement real-time scene changing effects to make my game could changing from spring to summer, summer to fall, fall to winter. And Chaning effects like this game. Giana Sisters.

I think Giana Sisters use animation to transit from two scenes, but I dont know how to make these animations.

Is any other suggestions could make this effects?


texts: A* Quad/Oc Tree path-finding vs Navigation Mesh path-finding

texts:
Main

What are the differences between those path-finding algorithms.

Is Navigation Mesh faster in finding the path?
Is it more correct than Quad/Oc Tree?
Does Navigation Mesh use Quad/Oc tree under the hood?

My problem is that while creating RTS game I have to make a decision between the 2. The main reason I haven't yet is that Quad Tree is a very good solution because the space is partitioned into bigger nodes that makes path finding quite faster. But if NavMesh in unity uses the same techniques under the hood then there is no reason to bother with Quad Tree.

I have noticed that by the way how the NavMesh is built in Unity it creates quite large chunks of NavMesh, so I can assume that this helps to reduce the calculations if the path lies through that big chunk.

Less Important

Also, I am wondering if NavMesh uses HPA* under the hood?

[With combination of Oct Tree that allows to partition path-finding to bigger chunks and calculate the path in them separately and then combine.] --- --- --- --- --- --- (This last part doesn't seem like it would be an optimization at all, as it just basically calculates the path the same way as without it, so the previous path would be recalculated anyway on fail, but if some custom design solutions could be added to it, like corridors to another part of nav mesh (thinking about it now - it could be implemented with current NavMesh as custom soltuion))

If any clarifications about the split into bigger chunks would be required I can try to draw and provide some images.


texts: How to fix this NullReferenceException error?

texts:
I am trying to fix an error that says "Object reference not set to an instance of an object". The purpose of this script is to spawn a prefab that follows the mouse when you click a UI button. The script works fine despite showing the error(yellow triangle), but when I add a line referencing another scripts array(marked >>>) in the HandleNewObjectHotkey function) the game refuses to run(red stop sign). For context, this script shown is attached to an empty game object. The button retrieves the script from this game object, and specifically uses the HandleNewObjectHotkey Function. I would like to know how I can fix the placeable Object Prefab from producing an error, or a suggestion to bypass it.
Things I've tried: making placeableObject prefab public, removing serialize field, attaching the prefab to the script itself in assets, change everything from private to public.
[SerializeField]
private GameObject placeableObjectPrefab;           // shows error here in visual studio, suggesting to make read-only (doesn't fix the problem)

private GameObject currentPlaceableObject;
private float mouseWheelRotation;
public int objectsSpawned;

// -------------- Money stuff

private float money;
private MoneyDisplay moneyDisplay;
private ObjectCostDisplay objectcostDisplay;

private void Awake()
{
    moneyDisplay = GameObject.FindObjectOfType<MoneyDisplay>();
    objectcostDisplay = GameObject.FindObjectOfType<ObjectCostDisplay>();
}

private void Update()
{

    if (currentPlaceableObject != null)
    {
        MoveCurrentPlaceableObjectToMouse();
        RotateFromMouseWheel();
        ReleaseIfClicked();
    }
}

private void ReleaseIfClicked()
{
    if (Input.GetMouseButtonDown(0))
    {
        currentPlaceableObject = null;
    }
}

private void RotateFromMouseWheel()
{
    mouseWheelRotation += Input.mouseScrollDelta.y;
    currentPlaceableObject.transform.Rotate(Vector3.up, mouseWheelRotation * 10f);
}

private void MoveCurrentPlaceableObjectToMouse()
{
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    RaycastHit hitInfo;
    if (Physics.Raycast(ray, out hitInfo))
    {
        currentPlaceableObject.transform.position = hitInfo.point;
        currentPlaceableObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
    }
}

public void HandleNewObjectHotkey()                                             //error says issue is in this function.
{
    money = objectcostDisplay.CostsList[0];   // >>>   adding this is what causes unity to refuse to run the game due to error mentioned. Deleting this lets game run, error still present.

    if (objectsSpawned <= 3 && money <= moneyDisplay.currentMoney)
    {
        if (currentPlaceableObject == null )
        {
            currentPlaceableObject = Instantiate(placeableObjectPrefab);
            objectsSpawned++;
            moneyDisplay.UpdateMoney(money);
        }
    }

    if(objectsSpawned == 3 && money <= moneyDisplay.currentMoney)
    {
        Debug.Log("You have reached the limit for this item!");
    }

    if(objectsSpawned <= 3 && money > moneyDisplay.currentMoney)
    {
        Debug.Log("You don't have enough money for this!");
    }
}

}


texts:
I am in charge of a game development club at my school and I'd like to work on a project this summer that I could use as a tutorial next semester. I have never done anything quite like this so I was wondering if anyone had any guide lines or ideas.

What I want to do basically is make a very simple game. Something like a top-down shooter where enemies come rush in for you to kill them and pick up some loot. However, I want everything to be very easily modified. The people in the club have little game development experience, so if I could set up my game in such a way that people could modify and add functionality with ease, it would be great for them.

Stuff like having an enemy class where the behavior is easy to play with, or making guns shoot differently/adding new guns, and new loot. Even adding new elements to the game. What would be the best way to build the game to allow this kind of malleability?


texts: Really weird peaks when profiling a simple scene with Unity3D

texts:
I need some help optimizing my game. I have spent last 3 days digging around with no luck. I have noticed really odd results in the unity profiler so, I have created a simple scene with just a cube and a camera, and again, really odd results. Could anybody have a look at this screenshots?:

You will see some significant peaks that make the frame time too high (30fps sometime or less). Scene hasn't any script, no coliders, no rigid bodies (notice the Physics simulate % in one of the shots).

Could anybody explain what is happening?

PD. Target platform is Android. This are taken from a Nexus 4 device.
PD2. Somebody can argue that this is not a real scenario, but I have had this problems in a real game myself and wanted to show a simple example to expose the problem.

Thanks in advance.


texts: Why is my tessellation output failing to reach my geometry shader?

texts:
I'm attempting to render grass using GLSL tessellation and geometry shaders. For vertex input, I'm using position and normal. For reference, here's an image of the grassy field without tessellation (just vertex, geometry, and fragment shaders). The geometry shader transforms individual points on the underlying mesh to rotated quads.

So, on to the tessllation step. Here's the vertex shader I'm using:
#version 440 core

in vec3 vPosition;
in vec3 vNormal;

out vec3 hPosition;
out vec3 hNormal;

void main()
{
    hPosition = vPosition;
    hNormal = vNormal;
}

Next up is the tessellation control (TC) shader. I'm passing position and normal through unchanged. Tessellation levels are hardcoded for testing purposes.
#version 440 core

layout (vertices = 1) out;

in vec3 hPosition[];
in vec3 hNormal[];

out vec3 ePosition[];
out vec3 eNormal[];

void main()
{
    ePosition[gl_InvocationID] = hPosition[gl_InvocationID];
    eNormal[gl_InvocationID] = hNormal[gl_InvocationID];

    if (gl_InvocationID == 0)
    {
        gl_TessLevelOuter[0] = 3;
        gl_TessLevelOuter[1] = 3;
        gl_TessLevelOuter[2] = 3;
        gl_TessLevelInner[0] = 3;
    }
}

The next stage is tessellation evaluation (TE). Here's my shader:
#version 440 core

layout (triangles, equal_spacing, cw) in;

in vec3 ePosition[];
in vec3 eNormal[];

out vec3 gPosition;
out vec3 gNormal;

void main()
{
    gPosition = tessLerp(ePosition[0], ePosition[1], ePosition[2]);
    gNormal = normalize(tessLerp(eNormal[0], eNormal[1], eNormal[2]));
}

Where tessLerp is defined as follows (applying barycentric coordinates):
vec3 tessLerp(vec3 v0, vec3 v1, vec3 v2)
{
    return v0 * gl_TessCoord.x + v1 * gl_TessCoord.y + v2 * gl_TessCoord.z;
}

My goal, then, is to have the output of the TE shader feed into the geometry shader, at which point the geometry and fragment shaders are unchanged from the non-tessellated version above. As input, the geometry shader takes layout (points) in;. Instead, I'm getting nothing (the curved green mesh itself is rendered separately from the grass):

Some common answers I've found in similar questions that I'm confident are not the problem here:

I'm calling glPatchParameteri(GL_PATCH_VERTICES, 3); before rendering.
My draw call is already using GL_PATCHES rather than GL_POINTS (used for the non-tessellated version). The specific draw call is glDrawElementsBaseVertex(GL_PATCHES, indexCount, GL_UNSIGNED_INT, (void*)0, 0);, where indexCount is the number of indices bound in the element array buffer for the mesh.
In the TC shader, I've tried layout (vertices = 3) out; rather than 1. My understanding is that using 3 causes indices to be computed (in order to form triangles), which I don't need for my purposes (since each tuft of grass is built from a single point).
From the vertex shader through the TC and TE, vertex positions are left unmodified from the base mesh (rather than being transformed to clip space). Instead, it's the geometry shader that applies the view-projection matrix when emitting four vertices to form a quad.

My understanding is that by rendering in this way (indexed) and with GL_PATCH_VERTICES set to 3, OpenGL will group every three vertices (i.e. each triangle) into a patch. Each triangle's data (three vertices, each containing position and normal) is passed from the TC shader to the TE shader (with primitive generation in between), then the TE shader computes new data (position and normal) by multiplying each tessellated vertex against barycentric coordinates. This results in a series of vertices that are passed to the geometry shader. Clearly, either my understanding is wrong or I've configured something incorrectly.
Why is my tessellated output not reaching my geometry shader?


texts: How to Color.Lerp between multiple colors?

texts:
I have found it rather difficult to find a solution to this in the Unity documents.

Color.Lerp(Color a, Color b, float t) is a function that gradually changes a color according to a step t, giving it the final value of the Color b.

How do I Lerp between multiple colors one after another?


texts: Where is Advertisement.Banner class in Unity Advertisement v2.3.1 package?

texts:
I'm implementing Unity Ads in my game, now i'm using Advertisement package v2.3.1 from package manager. I set up rewarded and video ad, but can't do anything with Banner ads.

I set up id in a project dashboard and just call Show function with banner placement id.

private IEnumerator ShowBannerWhenReady()
{
    while (!Advertisement.IsReady(bannerPlacementId))
    {
        yield return delay;
    }
    Debug.Log("Showing Banner");
    ShowOptions options = new ShowOptions {resultCallback = HandleBannerShowResult};
    Advertisement.Show(bannerPlacementId, options);
}

As for unity documentation Advertisement namespace have Banner class, but i don't see it in my project. So on android build i don't see any banner or smth, other ads work as expected.


texts: Getting ParticleSystemRenderer in inspector

texts:
I have a component that manipulates the sorting order of a given renderer, for the sake of managing UI layering. It looks something like this:
public class ManipulateSortingOrder : MonoBehaviour
{
    public Renderer Renderer;

    public void DoManipulation ()
    {
        // Renderer.sortingOrder = some value
    }
}

Now I want to plug a ParticleSystemRenderer into the Renderer field via drag and drop. I know I can get it via script using GetComponent, but whenever possible I like to supply dependencies using the inspector for the sake of testability, looser coupling, and generally writing as little code as possible.
That said, I can't seem to find the actual ParticleSystemRenderer component in any GameObject with a ParticleSystem. Dragging the "renderer module" (which I assume is some editor trickery disguising the actual underlying component?) doesn't seem to work. I've also tried looking at the ParticleSystem GameObject in debug mode in the inspector, but haven't seen a ParticleSystemRenderer component attached.
Is there a way to grab the ParticleSystemRenderer using the inspector, or is GetComponent the only way to go?


texts: Switching between VR and Desktop (VR Controllers are not tracked in Unity Build)

texts:
I am developing a VR App in Unity3D for HTC Vive Pro (Wireless) everything works well with VR in the usual way. (SteamVR Plugin 2.5.0 (SDK 1.8.19))

Except for some requirement reasons in the same Unity scene, I have to shutdown VR --> switch to Desktop mode and later at some point enable VR again. The moment, I enable it via script the VR display is ON, the HMD tracking works well but the Vive controllers are not tracked (position & rotation), I can see the controller model rendered though in the last position when the VR was shut down but I can't get the updated tracking. The issue is only happening in the Unity Build. In the editor, it is working fine now after this change.

To fix the issue in the Unity Editor: I tried changing the SteamVR_ActivateActionSetOnLoad method from Start() to OnEnable() as the error on re-enabling was related to controller actions missing, that is now fixed cause of this change.
e-g

 private void OnEnable()
        {
            if (actionSet != null && activateOnStart)
            {
                //Debug.Log(string.Format("[SteamVR] Activating {0} action set.", actionSet.fullPath));
                actionSet.Activate(forSources, 0, disableAllOtherActionSets);
            }
        }

I am looking for a solution, to fix the issue in the Unity build? Any suggestions are highly appreciated.


texts: How to detect what portion of a rectangle a point is in?

texts:
Say I have a rectangle and a point inside the rectangle. If the rectangle was split up diagonally, how could I tell which portion the point is in?

Here is a cute little mspaint diagram, where the portions are labeled with letters, and the point is shown with the red circle:

Also, if it helps, I am working in c++


texts: OpenAL seems to ignore sound attentuation/orientation for long sounds

texts:
I don't know how else to describe it in the title, sorry.

My sound engine currently works perfectly with listener positioning and sound positioning to create the attentuation and panning effects.  At least, for short sounds.

I converted an .mp3 to .wav to test out playing a song from a specific point, but suddenly OpenAL ignores that the sound and the listener are not at the same place and just plays the song at full volume right in the center.

Has anyone ever had this problem before?  If so, just what is the problem?

EDIT:
If it helps, the song is stereo and the sounds are mono, all at 16 bits per sample.


texts: When two RPC methods have the same name, which is called?

texts:
I have a situation where I would want two of the same components( in a hierarchy ), to be on a GameObject. If this component has an RPC method, it obviously cannot change name per instance of the component.

Which RPC method will be called? Unity says this:

"if two RPC functions in different scripts have the same name only one of them is called when RPC is invoked"

This says nothing about which will actually be called. Does Unity define a behavior for when this happens? Is there any alternatives that will avoid this?


texts: LibGDX collision with rectangle and circle

texts:
I have 2 objects, A and B, both are classes with only values, so positions and dimensions are only values (float posX,posY).

I have a render class which render A and B with shapeRenderer; A is rendered as a rectangle and B as a circle, how could check if there is a collision ?

edit:  I have a rectangle coming from up, when it hits the circle I have to stop the game


texts: Why doesn't my C#6 code compile in Unity?

texts:
Why can't Unity work with C# 6 code? It always gives me compiler errors. Here are some code examples:

using static System.Convert;
using static System.Environment;

$"€{punten}{NewLine}€{Money}{NewLine}€{KilledEnemies}{NewLine}€{bonus}{NewLine}€{total}";

I use Visual Studio as my code editor and build with no errors. If I press play in Unity it won't build.


texts:
I have a top down game. The player moves the avatar with WASD where W rotates the avator to 180, S rotates to 0, A rotates to 90 and D rotates to 270. I also do diagonal movement so if they hold SA it rotates to 45, WA it rotates to 135, WD it rotates to 225, and SD it rotates to 315.

I smoothly rotate from the current rotation to the hardcoded desired rotation based on those key combo's. Of course what happens is if I'm rotating from anything > 180 to 0 it goes the long way back to 0. So if I'm at 270 rotation and I press S key it sends it back to 0 but that goes from 270 to 0 vs going from 270 to 360 which would result in the same end result but how it got there would be shorter.

I was looking at this (https://answers.unity.com/questions/556480/rotate-the-shortest-way.html) and trying to translate it but it's not working. Below is my translation.

function Script:CalcShortestRot(current, target)
    --if current == target then return from end

    local dist = target - current + 180
    dist = dist - math.floor(dist / 2 / 180) * 2 * 180 - 180

    System:Print("Dist = "..dist)

    if dist < 0 then
        System:Print("Value 1 = "..target - current)
        return current - dist
    else
        System:Print("Value 2 = "..current + target)
        return current + dist
    end
end

The usage is:

-- determine the model rotation based on direction we are going
    if move > 0 then
        if strafe > 0 then
            self.targetRot = self:CalcShortestRot(self.targetRot, 225)
            --self.targetRot = 225
        elseif strafe < 0 then
            --self.targetRot = 135
            self.targetRot = self:CalcShortestRot(self.targetRot, 135)
        else
            --self.targetRot = 180
            self.targetRot = self:CalcShortestRot(self.targetRot, 180)
        end
    elseif move < 0 then
        if strafe > 0 then
            --self.targetRot = 315
            self.targetRot = self:CalcShortestRot(self.targetRot, 315)
        elseif strafe < 0 then
            --self.targetRot = 45
            self.targetRot = self:CalcShortestRot(self.targetRot, 45)
        else
            --self.targetRot = 0
            self.targetRot = self:CalcShortestRot(self.targetRot, 0)
        end
    elseif strafe > 0 then
        --self.targetRot = 270
        self.targetRot = self:CalcShortestRot(self.targetRot, 270)
    elseif strafe < 0 then
        --self.targetRot = 90
        self.targetRot = self:CalcShortestRot(self.targetRot, 90)
    end

    self.rot = Math:Curve(self.targetRot, self.rot, self.damping)

EDIT: updated my CalcShortestRot() function per comments below but still not working. It spins all around


texts: Creating transparent image with localGraphicsConfig not always working

texts:
I'm trying to use GraphicsConfiguration.createCompatibleImage to create transparent images.
This creates an empty image which I'm filling with a mosaic pattern later on in the code.

This seems to work like a charm on my iMac using the latest OSX.
When i switch (bootcamp) to Windows 7, the transparency doesn't work (just opaque images).
Is there something i'm missing?

I'm using Java 1.7.0_03 on Windows 7 (64)

I'm actually not quite sure if it's necessary to render the image using the localGraphicsConfiguration since the image/layer with the mosaic will never change. How can I solve this?


texts: Strange patterns on models with Unity Lightmap

texts:
To save performance and increase the details of static shadows I marked all static objects as static in my Unity Scene. Unfortunately there are now strange patterns on some of my models and I have no clue why. Execpt the sun every light source in my scene uses the mode "Baked".

I'm using Unity 2017.1.0f3 with DX11 on Windows 10 Home x64 and a NVidia GTX 780 Ti.

This is one of the affected models:

My Lightmapping Settings are the following:

Lightmapper: Enlighten
Indirect Resolution: 8 texels per unit
Lightmap Resolution: 80 texels per unit
Lightmap Padding: 2 texels
Lightmap Size: 2048
Compress Lightmaps: false
Ambient Occlusion: false
Final Gather: true
    Ray Count: 256
    Denoising: true
Directional Mode: Directional
Indirect Intensity: 1
Albedo Boost: 1
Lightmap Parameters: Default-HighResolution

The models were made with Blender 1.78c and the issue does not appear if I use only Realtime lights. Does anyone know this behavior and is there a way to fix it?

Thank you very much in advance! :)


texts: I'm getting empty errors Unity 2019.2.14f1 Windows 10

texts:
A week ago I was editing a script in my Unity Project with VSCode(I normally work in Visual Studio) and saved it. As soon as I saved it 4 blank errors popped up. Since then I've tried everything to get rid of them but to little avail. Please, help me.

I've already done a lot of searching and the main thing that comes up is to switch my scripting runtime to .Net 3.5. But in Unity 2019.2.14f1 the version I'm using this is no longer supported. They are also talking about Windows 7 but I'm on Windows 10.

https://forum.unity.com/threads/four-blank-errors-in-each-new-project.599980/

I tried to delete the meta of all script files but that did not help. I've tried to uninstall everything of Unity, and I mean everything. I uninstalled and deleted all Unity versions, the hub, and all app/roaming data. The reinstalled Unity. I made an empty project and the error was gone until I made 1 new script and the error reappeared.

Only when I have no scripts in my project the error disappears.

What do I do now? Any suggestions?


texts: Is it ok to remake a 2D game into first person and then releasing it for free?

texts:
I saw a video online where someone made a first person version of flappy bird, so I was wondering...

If I were to remake a 2D game into a 3D game and change the perspective to first person, and then proceed to release it online (like on itch.io) for free, would there be any repercussions?

The game concept and gameplay would be nearly identical with maybe a few changes, and while the art would be very similar, they'll still be original 3D models that I made myself, and differ from the actual assets used in the original game. All the code is original.

And could I just name it "First person (+ game name)" outright or is it better to name it something original?


texts:
So for practice and as a learning exercise i foolishly decided to make a text based rpg on my phone using the c4droid ide. ive done well and have learned a lot.

So far you can create a new character or load the previous one. and you can walk around in the rooms ive made.
currently the rooms load from a file when you enter it, and then it loads again every time you do anything except leave,which loads the next room instead. ill be tweaking my gameloop so it doesnt reload the room everytime soon.

My next step is the addition of mobs.   and here ive run into a problem i cant find the answer to with google.
My plan was/is to make a class for mobs and instantiate it when there was a mob present and load data from a file.  But then i was trying to figure out how to code which room to load them in.  First answer was to have the room file dictate which mobs, if any to load. great. except that i want the mobs to stay dead, not reapawn everytime the room reloads.
so now im wondering if i should be loading the rooms from file all at the same time before the game loop.  Potentially too memory intensive down the line when the game has more rooms and mobs? and what to load them to? i havent used arrays in c++ yet, though i have used map which seems similar. Im not even sure what a vector is.  i expect ill be needing to read up on those very soon.

so the basic question is this: leave loading the rooms the eay it is, load them all at the beginning of the game, or something else?

all help is appreciated


texts:
Let's say I have a cube, and that cube breaks apart into 100 different unevenly sized pieces.

How can I get the volume of each of those pieces compared to the cube's volume?

Using this in order to get the mass of each piece; for example, if the large cube is 100 mass, then the largest piece might be 30 and there might be some that are 0.2, etc...

Using C# and Unity with Rigidbodies


texts: Defining and selecting an area from an image

texts:
I want to create a game, where the world is loaded from an image file, much like Paradox Interactive does it for their games. If I have this image:

Then the red, green, blue, cyan, magenta, white, black and grey should be different provinces. I know how to loop through them, and check if it's a new province, the problem is that I don't know how to define the region of the province for selection: I don't know how I can load in data, to make sure you can click anywhere on that province, and make sure it gets selected.


texts: Getting individual sprites from png sprite sheets?

texts:
I'm using BYOB platform to get started in basic game development.

I was going to make a quick endless runner with a sprite downloaded from the net.

However, those sprites all come in sprite sheets, I guess for animation purposes.  I only need one sprite, can I extract that from the sheet with Gimp or Inkscape?


texts: Android Unity black screen on game start up

texts:
Squishing bugs on my first game currently, came across a problem I'm not sure what could cause.

When the game is launched there is simply a black screen before even the unity logo shows up, the duration is about 5 seconds. Checked on 2 devices: S6 and 1st gen Moto X, the duration is about the same.

The scene loaded on start-up is a simple menu with almost no logic, just some buttons.

I am using the Unity Google Play plug-in, could it be somehow connected with this issue?


texts: Game maps with "counties" that are split along lines that aren't necessarily straight

texts:
I want to create a game environment that supports a 2D map.  This is a really basic map, but must be split along lines that are not necessarily straight.  So imagine a country with county boundaries.  I then want to be able to detect drag / drop events within these counties.

What I'm really looking for here is a pointer to where to start on this (how it has been done before - any existing libraries out there), as I'm sure that what I'm trying to do is not new - although I can't find a beginners guide for this anywhere.


texts: Angle between character and mouse, and giving bullets velocity in the correct direction

texts:
I've been trying to work for a few days, on a little weapon system where you can aim with your mouse and shoot bullets in the direction you're aiming. This is all in 2D to be clear.

Right now, I can calculate the spawn point of the bullet at the tip of the gun quite well and the angle of the sprite is correct and pointing at the mouse however, I believe I am actually calculating the angle somehow inversely and because of this, I can't find a good way to give the bullets; when spawned; the correct starting velocity to fire in the correct direction as well as the correct sprite rotation.

I am calculating and setting the angle of the sprite to the angle given between the mouse position and the character position like so:
(Following code is in the Vector2 class)

double
Vector2::AngleRad(Vector2* other) {
    return atan2(other->y - y, other->x - x);
}

double
Vector2::AngleDeg(Vector2* other) {
    return radiansToDegrees(AngleRad(other));
}

and calculating the bullets spawn point (which works right now with the given angle, even though it's reversed) like so:
(Following code is in the weapon class)

void
Weapon::CalculateBulletExit()
{
    double centerX = GetPos()->x + GetCollisionBox()->W() / 2;
    double centerY = GetPos()->y + GetCollisionBox()->H() / 2;
    double radius = GetCollisionBox()->W() / 2;

    double radiansDeg = degreesToRadians(entityAngle);

    pointOfExit->x = (centerX + radius * cos(radiansDeg));
    pointOfExit->y = (centerY + radius * sin(radiansDeg));
}

So now I want to spawn a bullet at the correct position (the tip of the gun) with the right sprite rotation, and the the correct object velocity. Right now this is how I am doing that:
(Following code is in the bullet class)

bool
Bullet::Spawn(double heading, Vector2* spawnPoint, double bulletSpeed)
{
    if (mat->dead) {
        //Make the bullet alive and then return true that the bullet has been spawned
        mat->dead = false;

        //Set position and initial velocity
        double xGoPos = spawnPoint->x - GetCollisionBox()->W() / 2;
        double yGoPos = spawnPoint->y - GetCollisionBox()->H() / 2;

        entityBox->X(xGoPos);
        entityBox->Y(yGoPos);

        linearVelocity->x = xGoPos + cos(degreesToRadians(heading)) * bulletSpeed;
        linearVelocity->y = yGoPos + sin(degreesToRadians(heading)) * bulletSpeed;

        entityAngle = heading;

        return true;
    }
    else {
        return false;
    }
}

But this is spawning the bullet with a sprite rotation facing 180° backwards, and a velocity weirdly pointing downwards and away. Plus the velocity seems to always towards the right even when I am aiming left.

What is the easiest and fastest way of giving a bullet a velocity in the direction of the mouse (aiming direction) and am I actually calculating the angle correctly or horrifically wrong? :P

From what I've researched and read, there's heaps of ways of getting the angle between two vectors but all I am able to precisely know is the character's bounding box as x, y, w, h. The weapon bounding box as x, y, w, h. And the mouse position as an x, y vector2 class I made.
Thanks for any suggestions and help that I get!


texts: Ok, so I am making a first person shooter game and I am currently working on movement that looks and feels good.  I want to incorporate acceleration based movement for the player so that he has to accelerate  to max speed and decelerate to minimum speed.  Acceleration will happen when you have the key pressed and deceleration will happen when you let go of that key.  The problem is that there are some instances where you switch from moving forward to moving backward where no deceleration is needed because you could potentially be moving at double speed in the reverse if you did.  Does anyone have a good implementation of how to accomplish acceleration based movement that works well?


texts:
I'm trying to create a simple Breakout-style game. In my game, the ball strikes a paddle that moves with the player's mouse. Depending on the position of the strike, the ball changes its direction. This allows the player to aim the ball.

The problem I'm having is that each time I set the position, the ball loses velocity. I've tweaked every Physics2D setting I could find, but I'm not seeing any changes. Here's what my Ball class looks like:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ball : MonoBehaviour {

  public float initialVelocity;
  public float collisionAngleRange;
  public Paddle paddle;

  private Rigidbody2D body;

  public void Start() {
    body = GetComponent<Rigidbody2D>();
    body.velocity = VectorUtilities.AngleToVector2(135) * initialVelocity;
  }

  // When colliding with the paddle, use the position of the strike to adjust the ball's position.
  public void OnCollisionEnter2D(Collision2D collision) {

    // Ignore the object if it's not the paddle.
    if (!collision.gameObject.CompareTag("Paddle")) { return; }

    // Get the collision coordinates
    Bounds bounds = collision.gameObject.GetComponent<BoxCollider2D>().bounds;
    float left = bounds.min.x;
    float right = bounds.max.x;

    Vector2 contact = collision.contacts[0].point;

    // Interpolate the contact point and determine the angle.
    float interpolation = (contact.x - left) / (right - left);
    float angle = 90 - collisionAngleRange / 2 + collisionAngleRange * (1 - interpolation);

    // Change the direction of the ball without affecting its speed.
    body.velocity = VectorUtilities.AngleToVector2(angle) * body.velocity.magnitude;

    // Log what's happening with the velocity
    Debug.Log(body.velocity.magnitude);
  }
}

The VectorUtilities class looks like this:

using UnityEngine;

// A set of utility methods and extensions for Vector2 and Vector3.
public static class VectorUtilities {

  public static Vector2 AngleToVector2(float degrees) {
    return new Vector2(Mathf.Cos(degrees * Mathf.Deg2Rad), Mathf.Sin(degrees * Mathf.Deg2Rad));
  }
}

Here are my Ball game object's Rigidbody2D and CircleCollider2D settings:

The paddle's settings:

The material settings:

Physics2D settings:

I recognize I could solve this problem by multiplying the ball's normal vector by my desired speed, but it's more important to me to understand why this is happening and to fix the underlying problem. Why does the ball lose speed on every collision, and how can I prevent that from happening?


texts: Deferred rendering with both Clockwise and CounterClockwise culling

texts:
I have a deferred rendering system that works well with objects that appear solid and drawn using CounterClockwise culling.

I have a problem with Clockwise culled objects that are supposed to represent hollow that display their inside faces only.

The image below shows a CounterClockwise  culled object (left) Clockwise culled object (right).

Deferred Rendering CullMode http://rhysperkins.com/XNA/CullModeDeferred.png

The Clockwise culled object faces display what would be displayed on the CounterClockwise face.  How can I get the lighting to light the inner faces for Clockwise culled objects and continue lighting the outer CounterClockwise faces as normal?

My lighting method is below

    private void DeferredLighting(GameTime gameTime)
    {
        // Set the render target for the lights
        game.GraphicsDevice.SetRenderTarget(lightMap);

        // Clear the render target to (0, 0, 0, 0)
        game.GraphicsDevice.Clear(Color.Transparent);

        // Set the render states
        game.GraphicsDevice.BlendState = BlendState.Additive;
        game.GraphicsDevice.DepthStencilState = DepthStencilState.None;
        game.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

        // Set sampler state to Point as the Surface type requires it in XNA 4.0
        game.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;

        // Set the camera properties for all lights
        BaseLight.SetCameraProperties(game.ActiveCamera);

        // Draw the lights
        int numLights = lights.Count;

        for (int i = 0; i < numLights; ++i)
        {
            if (lights[i].Diffuse.W > 0f)
            {
                lights[i].Render(gameTime, ref normalMap, ref depthMap, ref sgrMap);
            }
        }

        // Resolve the render target
        game.GraphicsDevice.SetRenderTarget(null);
    }

I have tried adjusting the render states but no combination works for both objects.


texts: I would like to build a 2D multiplayer game. Do I need a game engine or not?

texts:
I plan to build a very basic 2D game in html5: it's purely a map divided in 2D equal square tiles. A player can click on a tile to see the message "behind" a tile. Once open, other players can't open it anymore.

So there are no teams, no physics, no complexe player moves just the need to be massively multiplayer and cross platform (it needs to be playable on computer but also mobile so touch is needed for example).

I have read this nice comparison between game engines http://buildnewgames.com/game-engine-comparison/ but I wonder:  do I really need a game engine or can i make without a game engine, just using javascript and all the necessary technologies(canvas, node, socket.io...) ? In what does it make my work easier/faster ?

thanks for your help,
Mathieu


texts: How to get PS3/Xbox 360 experience without having access to Dev kits?

texts:
I am a budding game programmer trying to get into the industry programming for PS3, Xbox 360.  The main problem I see is the need to demonstrate my skills to a potential employer, but without access to Dev kits for the PS3 or Xbox 360, doing this directly is impossible.

My question is, what is the best alternative way to show console developers my skills?

C++ programming in DirectX for Windows seems close to showing Xbox 360 programming skills, and C++ programming in OpenGL seems relatively close to showing PS3 programming skills.  Unfortunately, it seems from web research as if both Xbox 360 and PS3 actually have their own propietary libraries, therefore seeming to make this not a 100% fruitful endeavor.  This approach seems closest, but also most time consuming.  Plus you're not actually making anything run on the console.

On the other hand, programming in XNA has the benefit that your games are actually on the console, though I get the impression that this is looked upon as not "the real deal" since it is just a wrapper around DirectX and uses C# instead of C++.

Does anyone have knowledge or experience from inside the industry so as to know what kind of game demos would be most useful to show to a potential employer?  C++ in DirectX, OpenGL, XNA, Unreal Engine, Unity3d, Flash, etc etc etc?  There are only so many hours in the day, and I'd love to know how to direct my efforts.

My gut feeling is that DirectX would be the best choice, as it seems closer to what is used on the Xbox 360, but if having a good demo in another language/engine is just as good, it would obviously be less time consuming to go another route.

Thanks in advance for your help and advice!


texts: What is the best way to handle simultaneous collisions in a physics engine?

texts:
I'm writing a 2d physics engine in javascript so that I can learn more about physics in video games. I have it working correctly for rigid body collisions, except for if any body collides with two or more other bodies at the same time.

Currently for each pair of colliding bodies (A, B) I modify their velocities and angular velocities based on the collision impulse, and nudge them out from each other so they aren't penetrating. But then collision detection and impulse calculations for other collisions involving A will be wrong.

What approaches can I explore to get my engine working for 3+ objects colliding with each other?


texts:
I'm a .NET Core web developer trying to learn Unity. In web development, if I want to perform more than one domain function at a time, I either want to run it as a totally separate service (disjointed/microservice) or as a separate process (sidecar). In .NET Core we have IHostedService and other varying hosting abstractions, so creating small sidecar processes is fine, and in 3.0, even ASP.NET Core is considered a sidecar process because it's building on top of IHostBuilder for Generic Host support. My web development experience is primarily focused on distributed backend systems.

In my process of trying to learn Unity, I'm trying to understand how networking works in Unity. I was looking at their NetworkManager documentation, it seems most helpful for integrated host/client systems. I like that I can provide custom implementations of NetworkManager, and I think that will be most helpful. I've been reading up on asynchronous programming in Unity, and looking at their ECS Job System. It looks useful, but it also doesn't seem to be quite what I'm looking for. I'm looking for a background/sidecar process architecture the main Unity thread can call into as needed, but that doesn't interact with the main Unity thread at all, only it's lifecycle is tied to the main Unity thread.

In the asynchronous multiplayer game I am learning to create, the game's world is going to be a dedicated server running remotely, and the client will have to connect to it to load it's internal state. As the game's remote state is primarily near real-time, I was thinking about implementing a mixture of real-time and cached network managers. Something like this:

// Used for strongly consistent, real-time communication, talks to the remote server
// directly. The main Unity thread never calls this directly.
public RealtimeStateNetworkManager { }

// Used for GameObjects. Tries to load from cache before making real-time networking
// calls. Cache items are instantiated when GameObject makes initial call,
// then background threads keep the cache updated during the lifecycle
// of the GameObject.
public CachedNetworkManager : NetworkManager { }

For my CacheHostSidecar, I want to run it outside of the main thread as a sidecar process, so it doesn't affect the game client's core performance. The primary goal of the internal cache is to handle the network sync so client updates are real-time once the cache has been warmed, and then the cache updates it's internal state separate from the main unity thread on a ticking basis.

The process would like this:

My understanding of NetworkManager and it's function may be wrong. My core goal is to understand how I could intialize and run the CacheSidecarHost as a background/sidecar process when the main Unity thread starts so I can decouple networking from the main Unity thread.

My hope is that by decoupling the core networking functionality from the main Unity thread, it helps folks with poor network connections have an agreeable experience as the networking stack is implemented in a more sustainable/modern way, ensuring they can still play well enough in a game requiring an internet connection.


texts:
How do video games like Minecraft know how to place characters on an infinitely complex plane? For example, the game knows the character's place up to 10 or more decimal places and can display them at that location, but it only stores the blocks on the integer values. Here are other ways that I have thought about on how to phrase this question, because I know that I'm not being very clear:

How can a player exist at a non-integer location?
How can a player exist at a location that is not expressly defined?
How do non-existent coordinates contain players, even if they don't exist?
How can a game depict a player on coordinates it has not expressly stored?

I understand that the coordinates can be simply saved as doubles, but in order to store all the coordinates that a player could exist on would create a simply enormous file.


texts: How to compare two skeletons by using kinect sensor?

texts:
I need to know about how to compare record skeleton with live skeleton in C#. If there are any reference please let me know.

 example image for what I done up to now


texts: What is the logic of 'move_towards_point'?

texts:
I think I was using the move_towards_point function incorrectly. I discovered that I could not make the object move down.

In the create event, if I include the code move_towards_point(x,y,10);, the object in question moves to the right:

If I include the code move_towards_point(-x,y,10);, the object moves to the left:

I wanted to make the object move up, so I left x and used move_towards_point(x,-y,10);. It moved up as I wanted.

Yesterday, I had the need to make the object move down. That's where my dilemma began. I thought to use move_towards_point(x,+y,10);. It did not work; the object moved to the right, as in the first demonstration. I tried move_towards_point(0,y,0);. The object moved to the left, again, as in the second demonstration.

I began to suspect that I was not using the function correctly. By the name, I assumed it would move an object to a certain specific point. I went back to test move_towards_point(-x,-y,0);, and the object move diagonally:

I found the solution to all cases of movement:

Down : move_towards_point(obj_Bola.x,obj_Bola.y+1,10);
Up : move_towards_point(obj_Bola.x,obj_Bola.y-1,10);
Left : move_towards_point(obj_Bola.x-1,obj_Bola.y,10);
Right : move_towards_point(obj_Bola.x+1,obj_Bola.y,10);

The explanation seems to be that I am now using the x and y, relative to the object. When I do not want to change it's position on any of it's axis, I simply do not add any value. On the axis that I want the object to move in, I add or subtract a value.

One observation is that the value added or subtracted does not change the speed that the object moves, so move_towards_point(obj_Bola.x,obj_Bola.y+99999,10); moves the object down with a speed of 10.

I would like to know the logic behind move_towards_point, and if the way I solved my problem is the right one.


texts: How to limit speed while still adding external forces

texts:
I have a ship with a single thruster in space (no friction). My ship uses integration on every update, like this:

(PSEUDO CODE)

Update() {
  Velocity += Acceleration
  Velocity = Min(Velocity, MaxSpeed)
  Position += Velocity
  Acceleration = 0
}

Any force that interacts with the ship will accelerate it:

Accelerate(f) {
  f /= Mass
  Acceleration += f
}

Finally this is how I thrust the ship:

Thrust() {
  f = MaxThrustPower * Angle (cos/sin)
  Accelerate(f)
}

Like this I can accelerate my ship thrusting until MaxSpeed is reached.

The problem is that I also accelerate the ship with other forces line Gravity pulls, collisions, friction fields, etc. And all those forces, as they also add to velocity, they are also being truncated by the MaxSpeed limit.

At the other hand, once I have reached MaxSpeed, I cannot thrust any more to change my direction.

(This is a 2D game, not an exact simulator)

How can this be handled properly?

Thanks!


texts: SDL_LoadBMP into glTexImage2D results in scewed colors

texts:
I read up on this but i can not find the error.
Some suggest switching the format from RBA to RGBA but the surface data says it is 3 byte data.

Here are snippets and results of my source.

Loading the Image:

std::string bmpname = filename + ".bmp";

SDL_Surface * surface = SDL_LoadBMP(bmpname.c_str());
if (surface)
{
    glGenTextures(1, &m_texture_name);
    glBindTexture(GL_TEXTURE_2D, m_texture_name);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    GLenum mode;

    switch (surface->format->BytesPerPixel)
    {
    case 3: mode = GL_RGB; break;
    case 4: mode = GL_RGBA; break;
    default:
        BOOST_LOG_TRIVIAL(trace) << "" << *this << " failed recognize byteformat '" << bmpname << "'.";
        break;
    }

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0, mode, GL_UNSIGNED_BYTE, surface->pixels);
    SDL_FreeSurface(surface);
}
else
{
    BOOST_LOG_TRIVIAL(trace) << "" << *this << " failed to load '" << bmpname << "'.";
}

Output on the left, texture on the right:

Shaders:

//Vertex Shader
#version 120
attribute vec3 position_ATTRIB;
attribute vec2 texcoords_ATTRIB;
varying vec2 texcoords;
void main()
{
    texcoords = texcoords_ATTRIB;
    gl_Position = vec4(position_ATTRIB, 1.0);
}

//Fragment Shader
#version 120
uniform sampler2D diffuse;
varying vec2 texcoords;
void main()
{
    gl_FragColor = texture2D(diffuse, texcoords);
}

What is going on here, why is the color palette blueish?