texts: Getting child collider when collision occurs in compound object in unity3d?

texts:
I have a compound object. The parent of the compound object hierarchy has a script that is listening to the OnTrigerXXX callbacks of the children. When this compound object collides with other objects is there any way to get both colliders? I mean the "other" collider and the collider that belongs to the compound object itself that collided?

P.D: All rigid bodies must be kinematic, so, I can't use OnCollisionXXXX with the collision info param that has all the information I need in the contacts array.

Edit to add a bit more information as Savlon suggested:

When we are not using compound objects and we want to have a centralized place to handle children collision events, we could have something like this:

//In Children
void OnTriggerEnter(Collider c)
{
    (parent's script).TriggerHandler(this, c);
}

//In Parent
public void TriggerHandler(GameObject theChild, Collider c)
{
   // do stuff
}

This is ok and will work. The "problems" with this way are:

I could have a lot of children, so, using compound objects I would need to add just a rigid body component to the parent. This could be a pretty good memory reduction usage. However if I don't use compound objects I will have to add a rigid body to every child like in the previous code.
In my case children under a parent are always touching. Not intersecing but touching. Think about a set of blocks one beside the other. They do not intersect but there are no gaps between them. With compound objects I don't have to mess with it. It authomatically treats all the children as a whole and no collision callbacks will be fired among them.

On the other hand when using compund objects, you get all the advantages listed before but if you need information about what children collided with another collider you won't be able to get it because your script listening to callbacks is in the parent and you will only receive as parameter the "other" collider when unity calls you back through  OnTriggerXXXX callback.

I was asking if there is any way to get both colliders using a compound object.

Hope everything is clearer now.

Cheers


texts: Game asset : some are handled by POINTER, some by VALUE ; fear of inconsistency

texts:
A part of my game asset manager are divided into 3 layers.

1. Loader (Opengl-related) : MeshInternal, TextureInternal

A manager will ensure that 1 filename will be loaded only once.

2. Handle : MeshPtr , TexturePtr

This can be stored in game logic, and can be used in Material.
Each instance can be duplicated and can be stored by game logic.
They are just pointers to [1].

//game logic
MeshPtr meshptr=meshManager()->get(ROCKET_MESH);

3. 3D Material (Material)

It contained a fix amount of textures (e.g. lambertian, specular, emit, ...) and some tweaked color values (e.g. lambertian color multiplier).

It is stored by value, because each instance of in-game 3D-object  may duplicated it and customize it to match its unique attribute (e.g. red=low HP).

Game logic will cache it by value.

//game logic
Material mat=material()->mat_ROCKET; //shallow copy work well
//can also be called using enum

Question

Although everything work really good, my fear arise.

I store [2] by value.  It means I stored [1] in term of pointer.
I store [3] & [4] by value.

I think it is inconsistent, especially when I look at example code in [2]&[3] above.

How to professionally avoid this type of inconsistency?
... or is it the correct way to go?
Are there any disadvantage/limitation of this design?


texts: How can I draw a "vision cone" (targetting element) into the game world?

texts:
I'm wanting to indicate various things using a "pie slice" sort of shape as below.  Similar to vision cones in stealth game minimaps, or targetting indicators in RTS type games for frontal area attacks.  Something generic enough to be used for both would be ideal.

I need to be able to procedurally (and efficiently) change things like the slice width and length, color, transparency, position in the world, etc.  For my particular situation, there's no concern with elevation, funky terrain, or really any third axis at all as far as this element is concerned.

I have two first inclinations on how to accomplish this:
1) Manually generate the vertices for a main triangle, (possibly two, superimposed to get the border effect), a handful more to approximate the arc at the end, and roll it into a mesh.

2) Use some sort of 2D drawing library to create a circle and mask it off at the right angles, render to texture, and use that.

For reference, I have some experience with Ogre3D, but I'm not attached to it as this is a mostly academic pursuit at the moment.  Other technologies that might be better at accomplishing this are more than welcome.

Finally, I'm kind of curious about how to do a "flashlight" or similar 3D effect that could produce the same result, but on all surfaces in the lit area.


texts: Opengl textures change color of everything

texts:
Whenever I render textures, all shapes get the color of the texture. I'm not sure why, but I think it's something to do with the way I render textures. Here's what I use to draw textures:

public void drawTex(Texture t, int x, int y, int width, int height)
    {
        t.bind();
        glBegin(GL_QUADS);
        glTexCoord2f(0,0);
        glVertex2f(x,y);
        glTexCoord2f(1,0);
        glVertex2f(x+t.getTextureWidth(),y);
        glTexCoord2f(1,1);
        glVertex2f(x+t.getTextureWidth(),y+t.getTextureHeight());
        glTexCoord2f(0,1);
        glVertex2f(x,y+t.getTextureHeight());
        glEnd();
    }

Now I draw shapes like this:

public void drawQuad(int x, int y, int width, int height, float r, float g, float b)
    {

        glBegin(GL_QUADS);
    //  glColor3f (r, g, b);
        glVertex2f(x, y);
        glVertex2f(x + width, y);
        glVertex2f(x + width, y + height);
        glVertex2f(x, y + height);
        glEnd();
    }


texts: The gist of tweening with WebGL / OpenGL

texts:
I am trying to wrap my head around how to take advantage of shaders for things like tweening.

For example, there are these simple easing equations, which we can use like this:

var iteration = 0
var totalIterations = 200

requestAnimationFrame(render)

function render() {
  var currentValue = easeOutCubic(iteration, -100, 650, totalIterations)
  // apply current value to some object
  myObject.x = currentValue
  // do that for each object in the scene

  requestAnimationFrame(render)
}

function easeOutCubic(currentIteration, startValue, changeInValue, totalIterations) {
  return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 3) + 1) + startValue;
}

I'm wondering how you can translate something like this to using a shader to calculate the easing function. This is my attempt at piecing things together.

var vert = `
precision mediump float;

attribute float aPosition;
uniform vec2 uScreen;
uniform mat4 uModel;

void main() {
  vec2 position = vec2(aPosition, cubicOut(aPosition));

  position.x /= uScreen.x / uScreen.y;

  gl_Position = uModel * vec4(position.x, position.y, 1.0, 1.0);
}

float cubicOut(float t) {
  float f = t - 1.0;
  return f * f * f + 1.0;
}
`

var frag = `
precision mediump float;

void main() {
  gl_FragColor = vec4(0.9, 0.4, 0.6, 1);
}
`

var dims = []

function render() {
  dims[0] = gl.drawingBufferWidth
  dims[1] = gl.drawingBufferHeight
  gl.clearColor(0, 0, 0, 1)
  gl.clear(gl.COLOR_BUFFER_BIT)
  gl.viewport(0, 0, dims[0], dims[1])

  bindShaders()
  draw()

  requestAnimationFrame(render)
}

My main question is how I can tween multiple properties on multiple objects. I get the multiple objects part, but not sure how exactly to do multiple properties. For example, every object in a game will have it's color, alpha, x, y, width, and height, and rotation tweened.

color
alpha
x
y
width
height
rotation

If I wanted to create a shader that can tween all of these properties, I'm not quite sure if that's possible or what it would look like.

Wondering if one could point me in the right direction.

My first guess was to do this in the shader:

void main() {
  vec2 position.x = vec2(aPosition, cubicOut(aPosition.x));
  vec2 position.y = vec2(aPosition, cubicOut(aPosition.y));
  // width...
  // height...

  gl_Position = uModel * vec4(position.x, position.y, 1.0, 1.0);
}

But the shaders don't do width/height/rotation, just points. So I'm wondering generally (a) how many shaders this might need, and (b) a rough point-in-the-right-direction on how to go about calculating the width/height/rotation in the shaders, as well as if we can pack color/alpha/x/y all into one shader, given they might have different easings.

Let me know if it's too broad and I will try to break it up.


texts:
In these scene, i can't figure why, my player, and object it place, can't cast shadow on floor.

All other static objects in scene cast shodow correctly.

There is a floor with it's material, then there is also a Reflection probe.

Is Reflection Probe something that influence shadow cast correctly ?

Follow, floor proprieties

Floor material proprieties:

My Lights:

My scene:


texts: Apply external effects to player movement

texts:
In a 2D downhill game with the following, custom movement code, how do I apply external effects to the player's movement?
For example, when the player hits an obstacle, I want them to get bounced off the obstacle and briefly stop before they are able to continue moving. How do I best integrate those types of external effects into my movement code in a way that is scalable?
private void UpdatePlayerVelocity()
{
    // Calculate the player's vertical movement speed
    float speedY = maxSpeed.y * Time.fixedDeltaTime;

    // Calculate the player's horizontal movement speed
    float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

    // Set the player's new velocity
    rb.velocity = new Vector2(speedX, speedY);
}

My player-obstacle collision is handled in the obstacle class, and I am using an action to notify the player about the collision. So I have the ability to have a corresponding method in the player class that get's called when the collision occurs:
public void OnPlayerCollidedWithObstacle(Vector2 collisionNormal)
{
    // TODO:
    // Integrate the following into the above movement code ???
    // 1. Bounce the player off the obstacle
    // 2. Briefly stop the player from moving
    // 3. Continue moving when the player has tapped the screen
}

As a first step, I am thinking to wrap my default movement code in a bool check, so that it doesn't get run when the collision movement code is run.
However, I was hoping for a better, more scalable way?
PS: I would like to keep my movement code custom, so no Unity physics / AddForce / etc.

Update - Here is my attempt:
The following works. However, I am wondering if there is a cleaner / more systematic / more scalable way to handle this?
private void UpdatePlayerVelocity()
{
    // If no player-obstacle collision
    // and player has tapped to start/continue moving
    if (obstacleCollisionTimer <= 0 && playerHasTapped)
    {
        // Calculate the player's vertical movement speed
        float speedY = maxSpeed.y * Time.fixedDeltaTime;

        // Calculate the player's horizontal movement speed
        float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

        // Set the player's velocity
        rb.velocity = new Vector2(speedX, speedY);
    }
    // If player-obstacle collision resolved,
    // but player has not yet tapped to continue moving
    else if (obstacleCollisionTimer <= 0 && !playerHasTapped)
    {
        // Don't move
        rb.velocity = Vector2.zero;
    }
    // If currenty resolving player-obstacle collsion by bouncing player off
    else
    {
        rb.velocity = new Vector2(-collisionNormal.x, -collisionNormal.y);

        obstacleCollisionTimer -= Time.fixedDeltaTime;
    }
}

public void OnPlayerCollidedWithObstacle(Vector2 collisionNormal)
{
    // Collision normal will be used to bounce the player off the obstacle
    this.collisionNormal = collisionNormal;

    // Duration of the "bounce off" movement
    obstacleCollisionTimer = 0.2f;

    // The player needs to tap for movement to start again
    playerHasTapped = false;
}
```


texts: Detecting if ad is open, when user pressed "back" button

texts:
I am trying to reward a user a point whenever they watch/look at an ad. I give the user the reward whenever they watch the ad. However, the user earns a point even if they go to the ad and click back:

 mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {
                giveUserPoint();
                }
            }
        });

Is there a way I can see if the user clicked the back button while the ad was opened?

Maybe something like:

userBackClickListener(){
    if(adIsOpen){
     dontGiveUserPoint();
    }
}

How can I see if the ad was open while an action happened?


texts: Parallax Scrolling - Layers not preserving their relational positions

texts:
I've created a little 2D game engine with parallax scrolling and something has been bugging me for some time.

Layers / objects set at a different depths / z orders don't preserve their position relative to each other. The position of each layer after substaintial camera movement seems to decay and become inaccurate over time.

I have 3 layers / objects, each set at a different Z co-ordinate / layer depth. The higher the Z co-ordinate, the slower the layer moves; basically the more distant the layer is to the camera. Each layer being 1 level deeper than the next. For example:

layer1.z = 4;
layer2.z = 3;
layer3.z = 2;

Then, when rendering out all the layer positions every update. I use the following algorithm; let's use the first layer as an example:

layer1.x += (layer1.moveX -= cameraTarget.moveX) / layer1.moveZ;

moveX being the layer's / object's potentional movement modifier. So this should take into account not only the cameras movement, but the layers movement (if any) as well. This should allow dynamic bodies to work within the parallax scrolling paradigm.

For simplicities sake, even if I assume there are no dynamic bodies and just want to render background elements, I can simplify the above and do this instead:

layer1.x += (cameraTarget.moveX / layer1.moveZ) * -1;

I ASSUME this is the very core and basic math to doing parallax scrolling. Yet if I move the camera around enough, each layer seems to slightly offeset more and more. To test this, I even created a grid-like puzzle that fits together when all 3 layers match. It starts matching by default, and matches fine during the first initial movements, but after signifcant movements, it is unable to match perfectly again. Basically by moving the camera and tweaking it's position, I can't get the puzzle to match.

What am I doing wrong? I would think if everything passes through this algorithm, it should at least be consistant. Well, in saying that, to a casual observer it looks great, but on closer scrutiny it's flawed (I think). Is parallax scrolling natually decaying / desctructive to objects relational postioning to each other?

I am using Flash / ActionScript 3.0. One possibility I thought of was perhaps Flash's renderer could be doing something funky to my calculations when I assign these numbers to the x and y property of a DisplayObject. I've tried rounding too, in some naive attempt to make it more precise and perhaps have movement only to 1 sub-pixel.

UPDATE

My current setup is this, I have 3 layers, each of equal dimension layed out on the stage. So that at the start, the layers are where I want them, but they must just respond to camera movements.

layer1.z = 4;
layer1.x = 80;
layer1.y = 60;

layer2.z = 3;
layer2.x = 80;
layer2.y = 60;

layer2.z = 2;
layer2.x = 80;
layer2.y = 60;

// Place the player at the center of the screen, the camera directly follows / mimics the player's position
player.x = (stage.stageWidth / 2) - (player.width / 2);
player.y = (stage.stageHeight / 2) - (player.height / 2);

Then, in my render function that updates every frame:

// Capture camera movement
camera.x += cameraTarget.moveX; // cameraTarget being the player
camera.y += cameraTarget.moveY;

// Move all the layers
layer1.x = (camera.x + layer1.x) / layer1.moveZ;
layer1.y = (camera.y + layer1.y) / layer1.moveZ;

layer2.x = (camera.x + layer2.x) / layer2.moveZ;
layer2.y = (camera.y + layer2.y) / layer2.moveZ;

layer3.x = (camera.x + layer3.x) / layer3.moveZ;
layer3.y = (camera.y + layer3.y) / layer3.moveZ;

I've removed a few things my code has that would just confuse matters, but this is essentially what it does. For example, I have a loop that loops through an array of layers and then applies the transforms. Here, I'm only hardcoding it.

I also was using a Matrix to capture the rotation, scale etc... of the cameraTarget, which was nice.


texts: SDL2 SDL_CreateTexture returns pointer to existing texture

texts:
I have an initialized renderer in SDL2 that works fine.
I create some textures from images using SDL_CreateTextureFromSurface  and store them in a vector.

Afterwards, I create an empty texture so as to render to it a background texture and some text:
SDL_Texture * container = SDL_CreateTexture(Renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,size.first,size.second);

The problem is that the returned memory address in container is the address of the first texture that was created with renderer as shown in the image below.
Textures is a vector< SDL_Texture * > , container is the pointer above.

The textures field is a field in the renderer thatI presume is set to the address of the last texture created. Before running the command above, it pointed to the last texture created (0x222b70)

After the call, the texture in the vector is of course overwritten, which is a problem.
There are no errors from SDL_GetError().

What's going on?


texts: How do game companies handle DLL resources?

texts:
This question is based solely on curiosity. I have played a great many games on my PC over the years, and just now realized a trend across all games(most if not all). In the resources of the game, or in other words, next to the executable that runs the game, there are never DLL(Dynamic Link Library) binaries. This means that those games are created by statically linking to source files and dumping them all into the primary executable. I am certain that most of these game projects: Call of Duty, World of Warcraft, Splinter Cell, and [Include other arbitrary examples here], are utterly massive by scale and have hundreds of smaller children projects. I would probably not be wrong, either, in assuming that those same projects(such as API's, etc) could be packaged into a DLL instead of the obvious static linking. I apologize if it seems like I am rambling, but there is a point to this; it will be coming up soon. Next, I wanted to address the use of the games graphics API. Most games use DirectX, why is not relevant to this question; instead, it is how. Would I be safe to assume that said games are also statically linking to DirectX? And more importantly, why? Is there a logistical reasoning behind this inherently-conventional trait? Do game companies statically link all of their resources? And just again, why? Why not use DLLs instead?

Hopefully someone can answer this question, having been present or currently are present, working for an actual game company. Oh and I typed this all on my phone so I apologize for any errors.


texts: Java - Adjusting the speed of an object during movement

texts:
I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object.

xPosition += xSpeed;
yPosition += ySpeed;

I want the object to be moving at the same angle. But speed change randomly throughout movement across the canvas.

How can I go about dealing with this?

I've tried changing the speed, such as;

  xSpeed -= 10;
  ySpeed += 10;

Any help would be greatly appreciated.


texts: URP water showing Differently in on Runtime

texts:
I am using this water for my URP webgl build but the problem is it is showing differently on the editor. When I  run the game then it showing correctly and when I build and run it in the browser then it showing like the editor. here is the snap

water required Depth texture and opaque texture settings on and i have made it. Just start getting this problem from last two days. previously it was running fine. Here is the inspector:

Here are my URP settings and Quality SEttings:


texts: SSAO in my unity games has flickering lines at the top and right side of the screen

texts:
I've tried both the built-in unity ambient occlusion that comes with the post-processing stack, as well as another one ported from the Microsoft MiniEngine by someone: https://github.com/keijiro/MiniEngineAO.
Both of them have the same issue pictured below with these dark lines and the occlusion on the faces around the lines seem to flicker as the camera moves.

I've been trying to solve this issue by using the Microsoft MiniEngine AO and changing the compute shader. In one of my attempts, I changed the output of the shader from the calculated occlusion:
Occlusion[OutPixel] = lerp(1, ao, gIntensity);
to the depth texture UV to be sampled: Occlusion[OutPixel] = QuadCenterUV.x;
(QuadCenterUV probably being the center of the UV to sample for the 4 depth texture samples:)

// Fetch four depths and store them in LDS
#ifdef INTERLEAVE_RESULT
    float4 depths = DepthTex.Gather(samplerDepthTex, float3(QuadCenterUV,
DTid.z));
#else
    float4 depths = DepthTex.Gather(samplerDepthTex, QuadCenterUV);

and this was the output:

With a similar effect on the Y axis. I think that may be the cause, as the distortion of the UVs matches the distortion of the effect. I don't know how to fix this, because I don't have enough knowledge about RWBuffers or compute shaders. My terrain is generated by a noise function as a 2D array, constructed into a mesh, the mesh runs Mesh.RecalculateNormals(), and then is sent to the Mesh Filter. What is the issue here, and how can I fix it, or can anyone fix it for me?


texts: OpenGL ES 2.0 not drawing images with shadows

texts:
I'm using OpenGL ES 2 to program a simple game 2D for Android mobile phones. I'm coding the rendering portion of the software, using the GLES20 default library.
All my sprites are rendered from a large image containing all the pictures of what I need. I use very basic fragment and vertex shaders which are the following:
Vertex shader:
uniform mat4 uMVPMatrix;
attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
void main() {
     gl_Position = uMVPMatrix * vPosition;
     v_texCoord = a_texCoord;
 }

Fragment shader:
 precision mediump float;
 varying vec2 v_texCoord;
 uniform sampler2D s_texture;
 void main() {
      vec4 dst = texture2D(s_texture, v_texCoord);
      gl_FragColor = dst;

  }

Those are the shaders I use and everything is rendering fine.
I also set the blending function to:
 GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);

The problem is that I needed a sort of shadow around an object, so  I decided to solve this problem simply making the game image with already the shadow in it.
So, as you can see, here is a piece of my image with a large orange outside shadow so I get the effect that the main object (the two columns in the middle) is glowing.

(Ignore the black background, I put it there to make the shadow visible, it's not there in the real game image)
Anyway, when I render this image I get this result:

As you can clearly see, there is not any sort of shadow, even it is there in the source image.
What is really strange from my point of view is that I don't generate the shadow using the shaders, I created it in a very static (and probably not very effective) way: using Photoshop.
How can I make the outer orange glow visible ?
Thank you in advice


texts: Why translation uses multiplication and not addition?

texts:
To translate an object from (x, y, z) to (a + x, b + y, c + z) it's done using:

OK, that's cool, but why would we multiply in the first place when we can add the two matrices directly as:

addition is faster and more effective, plus it's straightforward?


texts: Unity Setting up the Universal Rendering Pipeline for Layer Masking

texts:
I've been watching this video about Field of View (Player) by CodeMonkey which explains on how to set up a scriptable rendering pipeline for the layer unmasking/masking of objects. However, the interface changed with the latest updates. There's an Opaque Layer Mask and there's a Transparent Layer Mask. I've followed the Render Features as described in the video but I wasn't able to get the masking done correctly as there's these two options that I can't seem to figure out what it does. I tried toggling to and from layers to see which one is meant to be in the other one but this is the best I could get:

For simplicity's sake, these are the layers that I am using:
Characters (things I want to see when the Field of View mask is over them):

player

enemy

friendly

dead

Field of view (the unmasking layer)
Fog of war (the thing that makes everything have a black transparent fog)
UI (the layer that I want to see regardless of the where the Field of view mask is)
As of right now, I could see the Field of View and the UI. Everything else is missing. I have asked in their own community; however, no one reached out to me. Let me know in the comments if you need more info.

edit 1:
to reproduce:

create the following layers (Player, Enemy, FogOfWar, FieldOfView, Wall, UI)
Set a game object with sprite component to player, enemy. Set them to the Player and Enemy respectively. This one, we want to see if the field of view layer is on top of it. They will be invisible if the field of view is not on top of it.
Place a Sprite Renderer (a square) and set it to the Wall. This one, we want to see regardless if it's masked or not. If the field of view layer is not on top of it, this should be darkened by the fog of war.
Set a Mesh Renderer (A simple plane would do) to Field of view and set it above the player and enemy. Make sure the face of the plane is facing the camera. This object would reveal or hide the Player and the Enemy layer. If this is on top of the FogOfWar, the area that the FieldOfView is upon will be invisible. That way, the sprites underneath it is not darkened.
Have a sprite renderer (A square) and set it to black with 50% opacity and make it cover the the Player, Enemy, and FieldOfView. Set this to FogOfWar
Create a button, and set it to UI layer
Create a universal rendering pipeline. head over to the options and add the settings (keep in mind, I don't know what to set here. The Opaque and Transparent Layer Mask are my problem.):

a. Opaque Layer Mask - Wall, FogOfWar, FieldOfView
b. Transparent Layer Mask - Player, Enemy

For the render features, add these three:

Behind Masks contain Player & Enemy

edit 2:
I forgot. I have three cameras. All orthographic. They only render a specific layer.

Main Camera - Culling Mask is Wall
Character Camera - Culling Masks are Player and Enemy
UI Camera - Culling Masks is UI

Character and UI camera have a depth. UI Camera's depth is 0. Character Camera's depth is 1. I want to render the UI below the characters. Hence, I separated them into their own camera.


texts: Can you create a PhysicsSprite in Cocos Studio?

texts: I do not see the ability to enable Physics in any way in Cocos Studio, am I missing something or is this a current shortcoming of the application?


texts: there is no problem when the camera is away, but as I zoom in to the game, the images disappear and I can't see the game properly. What is the reason ?


texts: How to make child transforms honor parent origin

texts:
I'm working on a 2D transform system that has the following requirements:

Transforms can have children
Transforms have anchor points/origins that offset them
Children should honor the parent's origin for translation
Rotations occur relative to the local origin (i.e. objects rotate
around their origin rather than the parent's)

As an example of what I'm looking for:
- You add red square in the middle of the screen and center its origin
- You add a white square, center its origin, scale it down slightly and make it a child of the red square
- Every frame you rotate both squares by a fixed amount

What you should see is a red square rotating around its center in the middle of the screen and a white square rotating inside the red square.

The way that I'm doing it now is something like this:

c = child;
p = child.parent;
c.local_transform.translate(c.translation);
c.local_transform.rotate(c.rotation);
c.local_transform.scale(c.scale);
c.local_transform.translate(c.origin.inverse());
c.local_transform.translate(p.origin);

c.world_transform = c.local_transform * p.world_transform;

This doesn't fully work however. The red square appears in the center and rotates around its origin but the white square seems to rotate both around its origin AND the world origin (i.e. the top left corner of the window).

What am I missing?


texts: How to export slick2d game into a jar with the res and native folder

texts:
I am a beginner in Slick2D.

I use jarspliceJarSplice to output Slick2D game.

But, but it is export all thingexports everything into one jar.

I want to export one jar with the res andand native folder ....

Soso I can easily modify the game resources in the design process.

Thanks for any help.


texts: Unreal Engine 4.15 Error C++ | ERROR: UBT ERROR: Failed to produce item UE4Editor-ProjectName.dll

texts:
I've already tried installing the Windows 8.1 SDK, but that did not work. Any Help? I'm running on windows 10 using visual studio 2017. I got this error when I created the project.

Error Log:

The project could not be compiled. Would you like to open it in Visual Studio?

Running C:/Program Files/Epic Games/UE_4.15/Engine/Binaries/DotNET/UnrealBuildTool.exe ThisIsGoingToWork Development Win64 -project="C:/Users/AaronX/Documents/Unreal Projects/ThisIsGoingToWork/ThisIsGoingToWork.uproject" -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for ThisIsGoingToWork (no existing makefile)
@progress push 5%
Parsing headers for ThisIsGoingToWorkEditor
  Running UnrealHeaderTool "C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\ThisIsGoingToWork.uproject" "C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\ThisIsGoingToWorkEditor\Development\ThisIsGoingToWorkEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for ThisIsGoingToWorkEditor in 8.3515565 seconds
@progress pop
Performing 9 actions (3 in parallel)
[2/9] Resource ModuleVersionResource.rc.inl
[3/9] Resource PCLaunch.rc
PCH.ThisIsGoingToWork.cpp
ThisIsGoingToWorkGameMode.cpp
ThisIsGoingToWorkCharacter.cpp
ThisIsGoingToWork.cpp
ThisIsGoingToWork.generated.cpp
[8/9] Link UE4Editor-ThisIsGoingToWork.dll
[9/9] Link UE4Editor-ThisIsGoingToWork.lib
   Creating library C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.lib and object C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.exp
   Creating library C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.suppressed.lib and object C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ThisIsGoingToWork.suppressed.exp
ThisIsGoingToWorkGameMode.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AGameModeBase::SetPause(class APlayerController *,class TBaseDelegate<bool>)" (?SetPause@AGameModeBase@@UEAA_NPEAVAPlayerController@@V?$TBaseDelegate@_N$$$V@@@Z)
ThisIsGoingToWork.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AGameModeBase::SetPause(class APlayerController *,class TBaseDelegate<bool>)" (?SetPause@AGameModeBase@@UEAA_NPEAVAPlayerController@@V?$TBaseDelegate@_N$$$V@@@Z)
C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Binaries\Win64\UE4Editor-ThisIsGoingToWork.dll : fatal error LNK1120: 1 unresolved externals
ERROR: UBT ERROR: Failed to produce item: C:\Users\AaronX\Documents\Unreal Projects\ThisIsGoingToWork\Binaries\Win64\UE4Editor-ThisIsGoingToWork.dll
Total build time: 92.21 seconds (Local executor: 0.00 seconds)


texts: How can I wait for all lines and instances to finish moving and then to destroy them?

texts:
void Update()
    {
        if (animateLines)
        {
            counter++;
            for (int i = 0; i < allLines.Length; i++)
            {
                endPos = allLines[i].GetComponent<EndHolder>().EndVector;
                Vector3 startPos = allLines[i].GetComponent<LineRenderer>().GetPosition(0);
                Vector3 tempPos = Vector3.Lerp(startPos, endPos, counter / 500f * speed);

                allLines[i].GetComponent<LineRenderer>().SetPosition(1, tempPos);

                instancesToMove[i].transform.position =
                    Vector3.MoveTowards(startPos, endPos, counter / 25f * speed);
            }

            for (int i = 0; i < allLines.Length; i++)
            {
                if (instancesToMove[i].transform.position == endPos)
                {
                    DestroyImmediate(instancesToMove[i]);
                    DestroyImmediate(allLines[i]);
                }
            }
        }
        else
        {
            counter = 0;
            foreach (GameObject thisline in allLines)
            {
                thisline.GetComponent<LineRenderer>().SetPosition(1, thisline.GetComponent<LineRenderer>().GetPosition(0));
            }
        }
    }

When doing:

for (int i = 0; i < allLines.Length; i++)
                {
                    if (instancesToMove[i].transform.position == endPos)
                    {
                        DestroyImmediate(instancesToMove[i]);
                        DestroyImmediate(allLines[i]);
                    }
                }

It's destroying only some of the lines and instancestomove and then give the exception:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.


texts: How to implement weighted blended order independent transparency in OpenGL?

texts:
I want to implement weighted blended OIT in my C++ OpenGL 3D game, but I didn't find any C++ examples about weighted blended order independent transparency.

Paper

How to clear accumTexture(framebuffer attachment) to vec4(0)?
How to clear revealageTexture(framebuffer attachment) to float(1)?


texts: How do I create a playing field of collapsing bubbles, as in Tsum Tsum?

texts:
Tsum Tsum App is a pretty interesting game and I am wondering how the main play area's data structure is, erm, structured?

Characters are stacked, disappear as the player swipes over matching ones, causing the ones above to fall down and replace them.

Tsum Tsum ⓒ Disney, via games.disney.com

Initially, it seems that it is a 2D hex grid?  But I see a lot of physics going on (Tsum Tsum bounce and roll off of each other).  In fact, it seems that even as you try to connect them that the chain can be interrupted while the Tsum Tsum are falling away from its closest neighbor.  Also, if you connect enough Tsum Tsum, a power-up bubble appears in the chain, which  pushes the Tsum Tsum out of the way.  So I'm doubting that this hex grid is constantly updating with the position of the Tsum Tsum given that the Tsum Tsum rarely stops moving.


texts: Programming Languages Recommendations:  A Space shooter game that allows two people to play

texts:
Do you remember an arcade game, that allowed two people to versus or play each other? It was a Galaga/Gradius type game.

Me and a couple of other people I know want to make a game like this. We want to get some other opinions on what programming languages to use. (C or C++ isn't an option).

We plan to use an engine to help us build the game and it's going to be a multiplayer game, so we would be handling the networking with this language as well.

We are thinking about C#, Java, or Actionscript 3.

Any advice on this? And if anyone knows the arcade game I am referring to please post up!

Edit

Let me add something here, this game will be played on computers and laptops only. We mainly want to know what's good for handling the networking and Dual screen play.


texts: Client Tells Server What Gamestate Data to Send Back

texts:
I'm just stepping into the world of MMORPGs and how they function, so assume I know very little.

in a game, a client doesn't see everything that the server does. For example, the client can't see through mountains, walls, etc. So why send them data that's not relevant?

My question is:
 - If the Client was designed to tell the server what gamestate data would be relevant to them, then the server sent back only what was relevant, could you minimize lag / amount of data downloaded?

You would have to find a way for the server to discern what data the client needed, maybe this is where it becomes inefficient?

Thanks for your time!


texts:
I am trying to make my 2D mesh render sprites with the same brightness as the original file.

On the below picture, the mesh on the left is darker than the UI Image on the right, which is an exact likeness of the original file. How can I make the mesh as bright as the Image?

So far, I've been looking into the following potential culprits:

Shader attached to the Mesh
Global lighting settings
Mesh renderer lighting settings

The above image is with Environment Lighting > Ambient Color at #FFFFFF.

Environment Lighting > Ambient Color > Intensity doesn't help.
Increasing the shader's emissions can offset the darkness but it's not an ideal solution.

All other lighting settings both globally and on the Mesh Renderer are default.

At this point, I'm lost :/
Any help would be much appreciated!


texts:
I want to design 3D games for my android smart phone. Though I that two powerful game development software like Blender (under Linux) supports 3D game development. My question is:

How can a game developed under Blender can be exported to Android devices?


texts: What is the most appropriate path-finding solution for a very large proceduraly generated environment?

texts:
I have been reading quite a bit in order to make the following choice: which path-finding solution should one implement in a game where the world proceduraly generated, of really large dimensions?

Here is how I see the main solutions and their pros/cons:

1) grid-based path-finding - this is the only option that would not require any pre-processing, which fits well. However, as the world expands, memory used grows exponentially up to insane levels. This can be handled in terms of processing paths, trough solutions such as the Block A* or Subgoal A* algorithms. However, the memory usage is the problem difficult to circumvent;

2) navmesh - this would be lovely to have, due to its precision, fast path calculation and low memory usage. However, it can take an obscene pre-processing time.

3) visibility graph - this option also needs high pre-processing time, although it can be lessened by the use of fast pre-processing algorithms. Then, path calculation is generally fast too. But memory usage can get even more insane than grid-based depending on the configuration of the procedural world.

So, what would be best approach (others not present in this list are also welcome) for such a situation? Are there techniques or tricks that can be used to handle procedural infinite-like worlds?

Suggestions, ideas and references are all welcome.

EDIT:

Just to give more details, one should see the application I am talking about as a very very large office level, where rooms are generated prodecuraly. The algorithm works like the following. First, rooms are placed. Next, walls. Then the doors and later the furniture/obstacles that go in each room. So, the environment can get really huge and with lots of objects, since new rooms are generated once the players approaches the boundary of the already generated area. It means that there will be not large open areas without obstacles.


texts: How real time volumetric light beam effect could be achieved in opengl?

texts:
Here is 1.5 mins long video to give you an example of what I meant. From research that I did , regarding lighting effect, usually it is done offline (post-processing) using algorithms like "god rays" or "ray marching" with "volumetric fog" but how to achieve the same result in real time? Do I have to draw a cone? If yes, then should it be only the shell of a cone  meaning   that cone is empty inside? Or even inside of a cone there should be vertices?
Question: What techniques or algorithms are used to achieve such a result?
EDIT 1:
Just an example what I am working on.
Here I do have 2 objects (a human object and a cube). I am using cube to simulate x-ray machine and currently I am trying to added x-ray beam effect which has to be in the shape of pyramid. However I have troubles building the effect of the beam.
My scene:

god ray fragment shader:
#version 330 core
out vec4 FragColor;

in vec2 TexCoords;

uniform vec2 lightPositionOnScreen;
uniform sampler2D screenTexture;

const float exposure = 0.3f;
const float decay = 0.96815 ; // 0.96815
const float density  = 0.926;
const float weight  = 0.1; // 0.587
const int NUM_SAMPLES = 100;

void main()
{
    vec2 deltaTexCoord = vec2(TexCoords.xy - lightPositionOnScreen.xy);
    vec2 texCoord = TexCoords;

    deltaTexCoord *= 1.0f / NUM_SAMPLES * density;

    vec3 color = texture(screenTexture, TexCoords).rgb;

    float illuminationDecay = 1.0f;

    for (int i = 0; i < NUM_SAMPLES; i++)
    {
        texCoord -= deltaTexCoord;

        vec3 sample = texture(screenTexture, texCoord).rgb;

        sample *= illuminationDecay * weight;

        color += sample;

        illuminationDecay *= decay;
    }

    FragColor  = vec4(color * exposure, 1.0);
}

god ray vertex shader:
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;

out vec2 TexCoords;

void main()
{
    gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
    TexCoords = aTexCoords;
}
```


texts:
I'm trying to render a hemisphere in OpenGL, the problem that the hemisphere isn't rendered at all, only part of it. I initialize it, then at each frame I draw it using the following code. I'm trying to use a VBO for drawing it.

void Jellyfish::Init_HemiSphere(const float radius, const int segments )
{

    m_iSegements = segments;
    m_fVerts= new float[(segments+1)*2*3];
    m_fNormals= new float[(segments+1)*2*3];
    m_fTexCoords = new float[(segments+1)*2*2];

    for( int j = 0; j < segments / 2; j++ )
    {
        float theta1 = j * 2 * 3.14159f / segments - ( 3.14159f );
        float theta2 = (j + 1) * 2 * 3.14159f / segments - ( 3.14159f );

        for( int i = 0; i <= segments; i++ )
        {
            Vec3f e, p;
            float theta3 = i * 2 * 3.14159f / segments;

            e.x = math<float>::cos( theta1 ) * math<float>::cos( theta3 );
            e.y = math<float>::sin( theta1 );
            e.z = math<float>::cos( theta1 ) * math<float>::sin( theta3 );
            p = e * radius;
            m_fNormals[i*3*2+0] = e.x; m_fNormals[i*3*2+1] = e.y; m_fNormals[i*3*2+2] = e.z;
            m_fTexCoords[i*2*2+0] = 0.999f - i / (float)segments; m_fTexCoords[i*2*2+1] = 0.999f - 2 * j / (float)segments;
            m_fVerts[i*3*2+0] = p.x; m_fVerts[i*3*2+1] = p.y; m_fVerts[i*3*2+2] = p.z;

            e.x = math<float>::cos( theta2 ) * math<float>::cos( theta3 );
            e.y = math<float>::sin( theta2 );
            e.z = math<float>::cos( theta2 ) * math<float>::sin( theta3 );
            p = e * radius;
            m_fNormals[i*3*2+3] = e.x; m_fNormals[i*3*2+4] = e.y; m_fNormals[i*3*2+5] = e.z;
            m_fTexCoords[i*2*2+2] = 0.999f - i / (float)segments; m_fTexCoords[i*2*2+3] = 0.999f - 2 * ( j + 1 ) / (float)segments;
            m_fVerts[i*3*2+3] = p.x; m_fVerts[i*3*2+4] = p.y; m_fVerts[i*3*2+5] = p.z;
        }

    }

    glGenBuffers(3,&SVboId[0]);
    //Vertex
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[0]);
    glBufferData(GL_ARRAY_BUFFER,sizeof(*m_fVerts)*(m_iSegements+1)*2*3,
        m_fVerts,GL_DYNAMIC_DRAW);
    // Normals
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[1]);
    glBufferData(GL_ARRAY_BUFFER,sizeof(*m_fNormals)*(m_iSegements+1)*2*3,
        m_fNormals,GL_DYNAMIC_DRAW);

}

void Jellyfish::drawHemiSphere( )
{

    /*glEnableClientState( GL_VERTEX_ARRAY );
    glVertexPointer( 3, GL_FLOAT, sizeof(*m_fVerts)*(m_iSegements+1)*2*3, m_fVerts );*/

    glEnableClientState( GL_VERTEX_ARRAY );
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[0]);
    glVertexPointer( 3, GL_FLOAT, 0, 0 );

    glEnableClientState( GL_NORMAL_ARRAY );
    glBindBuffer(GL_NORMAL_ARRAY,SVboId[1]);
    glNormalPointer( GL_FLOAT, 0,0 );

    /*glEnableClientState( GL_TEXTURE_COORD_ARRAY );
    glTexCoordPointer( 2, GL_FLOAT,  sizeof(*m_fTexCoords)*(m_iSegements+1)*2*3, m_fTexCoords );
    glEnableClientState( GL_NORMAL_ARRAY );
    glNormalPointer( GL_FLOAT, sizeof(*m_fNormals)*(m_iSegements+1)*2*2, m_fNormals );*/
    for( int j = 0; j < m_iSegements / 2; j++ ) {

        for( int i = 0; i <= m_iSegements; i++ )
        {

        }

        glDrawArrays( GL_TRIANGLES, 0,   (m_iSegements + 1)*2   );
    }

    glDisableClientState( GL_VERTEX_ARRAY );
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );
    glDisableClientState( GL_NORMAL_ARRAY );

}


texts: Where are the logs created by Unreal Frontend?

texts: I am trying to read errors generated by a build and cannot locate the log file. Which directory is it in?


texts: *DX11, HLSL* - Colour as 4 floats or one UINT

texts:
With the DX11 pipeline, would it be much quicker for the vertex buffer to pass one single UINT with one byte per channel to the input assembler, as opposed to three floats? Then the vertex shader would convert the four bytes to four floats, which I guess is the required colour format for the pipeline. In this instance, colour accuracy isn't an issue.

The vertex buffer would need to be updated many times per frame, so using a single UINT and saving 12 bytes for every vertex could well be worth it: quicker uploads to vram and also less memory used. But the cost is the extra shader work for every vertex to convert each 8 bits of the input UNIT into a float.

Anyone have an idea if it might be worth doing?

Or, is it possible for the pipeline to be set to just internally use a four-byte colour format? The swap chain buffer has been initialised as DXGI_FORMAT_R8G8B8A8_UNORM, so ultimately that's how the colour will be written.

Thanks!


texts: Dynamic Aspect Ratio in Unity (for Anti-Aliasing)

texts: I am using HDRP with 1920x1080 resolution. The anti-aliasing works very well if the screen resolution increases and it works really bad if the screen resolution is lower than 1920x1080. Why does this happen? Is there a way to overcome this?


texts: How can I unregister an event from another scene or another script?

texts:
This is where and how I register the event :
void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale == 0)
            {
                DisableEnableUiTexts(true);
                SceneManager.UnloadSceneAsync(0);
                if (fadeImage != null)
                    fadeImage.SetActive(true);
                GetGameMusicVolume();
                Cursor.visible = false;
                Time.timeScale = 1;
            }
            else
            {
                Time.timeScale = 0;
                MenuController.LoadSceneForSavedGame = false;
                SceneManager.LoadScene(0, LoadSceneMode.Additive);
                SceneManager.sceneLoaded += SceneManager_sceneLoaded;
                Cursor.visible = true;
            }
        }
    }

And the event :
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
    {
    }

I need to be able to unregister the event either from another scene or another script.


texts: my movement is working good on keyboard but on android its not

texts:
So basically here is what my movement is like for keys:

key down

 if (keycode == Keys.LEFT) {
                mishi.getAcceleration().x = -13;
            }

key up

if (keycode == Keys.LEFT) {
            mishi.getAcceleration().x = 0;
            mishi.getVelocity().x = 0;
            mishi.setRotation(0);
        }

touch down

            if (x >= 0 && x < 1 && y > 5 && y < 8) {
                mishi.getAcceleration().x = -13;
            }

touch up

if (x >= 0 && x < 1 && y > 5 && y < 8) {
            mishi.getAcceleration().x = 0;
            mishi.getVelocity().x = 0;
            mishi.setRotation(0);
        }

So its basically the same thing, however, on android when I move around my player doesn't stop he just keeps going. Its hard to explain but it just feels and looks wrong, you have to touch around to get it to work properly but its unplayable. I think it has to do with the fact that I am moving with 2 touches but not sure how to handle it. I tried adding 2 input processes and combining them but it produced the same results.

I saw some code online using a map to hold in the pointers but I am not sure how to utilize those pointers in this scenario where 2 keys being pressed are both for movement and they need to be combined so that I can move up/right or down/left diagonally.


texts: Starting a Game Dev Incubator - Engines to Start With?

texts:
I'm currently in the process of developing a technology incubator in my region to cater to game development professionals and aspiring devs and I'm curious about what engines are best to use, with regards to flexible licensing (e.g. right now we're on a shoestring budget) and also performance/popularity and a solid community/company backing.

As my background is in web development my focus with this group is more of the management and logistics while other professionals will be on the board to handle the other aspects, but I'm still  trying to pick a few solid engines.

Garry's Mod at the moment seems to be the most feasible option since I've used it a lot and I know it's simple to pick up, but I wanted to ask if there is anything similar to that.

Also, this group is purely for PC gaming so we're not handling consoles and we are ideally looking to do 2-D and 3-D development or even game engine coding.


texts:
Im programming a small project, an opengl height map.
It is build of triangles, which points are fit to the right y position (read out of an image).

The player is represanted by a cuboid. (p1, p2, ... p8).
now, i want to implement collision detection between the player and the heightmap.

I thought about split the whole world in cubes, and this cubes again in cubes, and then distribute the triangles of the heightmap in this cubes (then check for the big cube, the smaller cube, which contains the player, and then check all triangles for collision).

But which collision detection method would be the best here, and how could i implement it?
(By the way, im using lwjgl [java])


texts: I'm starting to make a checkers game and I've got all my graphics + the board drawn. Before I moved on to creating the pieces I was wondering what an easy way to tackle the logic side of the movement of pieces.. Should I make a table of every square, detecting if it has a piece and if so, what color? (i.e 0=empty, 1=red, 2=black) or do you guys have a better idea to this issue? Thanks in advance.


texts:
I'm looking for a way to have different sprite animations in individual Android views.

I try to use LibGDX and AndEngine but most I could find was how to get an Activity with the sprite animation.

Is there a way to accomplish this with native Android or a library?

Thanks for the help. Jose


texts: Do open world games need less backstory?

texts:
I've played a few open-world games and really enjoyed them, though the ones I've really enjoyed have generally received complaints about how little story there is to them.

The Saboteur is one example of this. Fully open-world, good enough story (for me, anyway), engaging gameplay, and still has received complaints in reviews about not having enough story.

Do open-world games actually need a full, all-encompassing story? Or can fun and engaging gameplay fill in the gap and let the designer get away with a slightly less complete story?


texts: Shooting intervals with variable framerates

texts:
lets say i have a gun which fires at a rate of 10 shots every seconds.

so i every gameloop frame, i check if the necessary time has passed and instantiate a new shot.

now what if the framerate of the game actually drops below 10 fps. then the player will have a disadvantage because his gun doesnt fire accordingly anymore.

what is the usual workaround of this problem?

thanks!


texts: Why does Intel Graphics Monitor crash after I set a depth stencil state in my Direct3D 11 application?

texts: I'm programming a managed Direct3D 11 application with SlimDX. I want to use Intel Graphics Monitor to capture draw calls for a single frame. When I try to set a depth stencil state my application crashes...any ideas?


texts: Client-Server RTS networking with lockstep and lag

texts:
The peer to peer lockstep networking model would seem to indicate that everyone's input is delayed the same amount. And so this would indicate that everyone would feel the same lag in response to their input.

But in Warcraft 3 from playing many custom games it is clear that the creator of a custom game has much faster response time to their input. How can this be given the lockstep model?


texts: Say I have an two dimensional array with values 0 or 1. How would I construct an algorithm (preferably in C#) to work out which ones are separated or islands. The algorithm would transform the left 2d array to look something more like the right array?


texts:
I want to know how to make character hit ground and lose health. For example: when character is falling of one meter he losing only a small part of his health, and when he's falling of 10 metters he dying.

I just want to know if it's about speed or distance or maybe even time? (If you can implement some code. please.)

P.S. I'm planning to use SFML and C++.


texts:
I downloaded a bat model from the internet and I went to Blender, used texture and shading as I want, then I exported it as a fbx file. Next I placed it into my content pipeline and ran it but it is asking me for the path of a .fbm file. It says Error Missing asset

  C: ...._Game\obj\x86\Debug\FBX\387D35A3\bat.fbm\wpn_fps_mel_barbedwire_df.dds

What does this mean. How can I place these images in that file like that?


texts: Windows Phone Performance Analysis makes game run faster. Possible reasons?

texts:
A XNA game I was making was running slowly on my WP7 device. However when I started it in Windows Phone Performance Analysis to find the bottleneck, the game ran smoothly on the same device.

I figured the problem out a little later, and it was an adjacency-checking function. I have optimized the function and the game works fine now.

Why was the game magically speeding up in Perf Analysis mode? Any possible explanations?

This was the code that ran faster on the Perf Analysis mode, but slow otherwise. It is a damage-dealing function in a tower defense game.

 foreach (Target myTarget in _targets)
 {
        for (int x = -1; x <= 1; x++)
        {
                for (int y = -1; y <= 1; y++)
                {
                    if (x == 0 && y == 0) continue;
                    try
                    {
                        Tile adjacent = _tiles[(int)myTarget.CurrentTile.X + x, (int)myTarget.CurrentTile.Y + y];
                        if (adjacent.Tower != null)
                        {
                            DealDamage(myTarget, adjacent.Tower);
                        }
                    }
                    catch
                    {
                    }
                }
            }
 }

I optimized it later by checking damage for each tower instead of each target.


texts:
I figured this is would be the correct place to ask the following ...

1) How would I go about making multiple object collision detection (Bullets For Example)?

2) How would I make it efficient enough so that I can have many objects be able to detect collision of other objects.

The only idea I currently have is for each bullet to iterate through the other game objects and check collision individually. But that could/would have a terrible impact on time, considering that there can be many objects in the scene. I have also considered multi threading, but I really don't know how to apply it in game programming. Any Suggestions?


texts: Download Progress bar from Firebase Storage

texts:
Im trying to make a progress bar based on downloaded images from Firebase storage, now firebase does provide a snipper which works per image
// Create local filesystem URL
string localUrl = "file:///local/images/island.jpg";

// Start downloading a file
Task task = reference.GetFileAsync(localFile,
    new StorageProgress<DownloadState>(state => {
        // called periodically during the download
        Debug.Log(String.Format(
            "Progress: {0} of {1} bytes transferred.",
            state.BytesTransferred,
            state.TotalByteCount
        ));
    }), CancellationToken.None);

task.ContinueWithOnMainThread(resultTask => {
    if (!resultTask.IsFaulted && !resultTask.IsCanceled) {
        Debug.Log("Download finished.");
    }
});

but i would like to make that appear on a UI text based on the percentage of the Bytes downloaded like starting from 0 to 100%.Now i have come to this function so far which does work in the sense of downloading from storage and i do get the percentage in the console but im not sure how to convert that to a percentage to show on UI.
        if (CheckConnectivity) //if the device is connected to the internet, initiate download.
        {
           // Debug.Log("Initiating download of: " + platform + _file);
            if (!File.Exists(localPath))
            {
            Task task = storageRef.GetFileAsync(localPath,
            new StorageProgress<DownloadState>(state => {
                    // called periodically during the download
                    Debug.Log(String.Format(
                "Progress: {0} of {1} bytes transferred.",
                state.BytesTransferred,
                state.TotalByteCount
            ));
            }), CancellationToken.None);

                await storageRef.Child(_child).Child(_file).GetFileAsync(localPath).ContinueWithOnMainThread(files =>
                {
                    if (!files.IsFaulted && !files.IsCanceled) //if download is successful.
                    {
                        Debug.Log("file saved as " + localPath);

                    }
                    else //otherwise report error.
                    {
                        Debug.Log(files.Exception.ToString());
                    }
                });
            }
            else
            {
                Debug.Log("files Exist");
            }

        }
        else //otherwise don't bother.
        {
            Debug.Log("Cannot Download file due to lack of connectivity!");
        }
    }

in which case my debug is this
Progress: 1731 of 52804 bytes transferred.

Which i would like to say 0 % and counting up to 100!
Thanks!


texts: Separation of axis theorem implementation

texts:
I have been following the this guide to implement this. My current implementation is the following:

class SAT {

  SAT();

  bool collides(Rectangle rect1, Rectangle rect2){
    var axises = [
                  rect1.topRight-rect1.topLeft,
                  rect1.topRight-rect1.bottomRight,
                  rect2.topLeft-rect2.bottomLeft,
                  rect2.topLeft-rect2.topRight
                  ];

    for(var axis in axises){
      Projection p1 = project(axis,rect1);
      Projection p2 = project(axis,rect2);
      if(!overlap(p1,p2)){
        return false;
      }
    }
    return true;
  }

  Projection project(Position axis, Rectangle rect){
    Position projection = getProjectionPosition(axis,rect);
    Collection<Position> corners = [rect.topLeft,rect.topRight,rect.bottomRight,rect.bottomLeft];
    num min = dot(projection,corners[0]);
    num max = min;
    for(var i = 1; i < corners.length; i++){
      num p = dot(projection,corners[i]);
      if(p < min){
        min = p;
      }else if(p > max){
        max = p;
      }
    }
    return new Projection(min,max);
  }

  bool overlap(Projection p1, Projection p2){
    return p1.max >= p2.min && p1.min <= p2.max;
  }

  num dot(Position projection, Position point){
    return projection.x*point.x + projection.y*point.y;
  }

  Position getProjectionPosition(Position axis, Rectangle rect){
    num p = (rect.topRight.x*axis.x+rect.topRight.y*axis.y)/(Math.pow(axis.x, 2)+Math.pow(axis.y, 2));
    Position projected = new Position(p*axis.x,p*axis.y);
    return projected;
  }
}

However this doesn't seem to work. I think I might be a bit confused about the getProjectionPosition algorithm, as you can see I always use rect.topRight. But maybe I am supposed to loop trough all the corners of the rectangle? or should it just be the corner belonging to this axis? The guide wasn't very clear on this.

Any ideas on whats wrong? Or is there a reference implementation I could look at to see how my implementation differs?


texts: Sounds overlapping when playing too many at the same time

texts:
I am pretty novice when it comes to game sound management, so excuse my ignorance.

I am having an issue when playing too many sounds at the same time where some sounds stop playing, or doesn't play at all, almost like some sounds overlap others. I've read some about the sounds using individual buffers and that there should be no problem playing these at the same time at runtime. When I only had a small ammount of sounds in the game, it all worked flawlessly. My SoundManager had no problem playing multiple sounds at the same time ( I loaded the sound to memory when I  was going to play it and disposed it when it was done playing, approx. 5 seconds).

My SoundManager Class

I've recorded a video to better illustrate what this sound problem is. As you can hear in the video below, the attacking sounds can only be heard at some points, as for some enemy sounds. The idling sounds of the enemies (breathing and bat sounds) seem to work without issues, though.

Video

Thank you for helping, because I have no clue how to fix this issue. Is there something that I've left out in my SoundManager?


texts: Force propagation through physic bodies constraints (as non-penetration)

texts:
First, some context

I'm currently implementing a (well, tiny) game engine using a predictive approach. The idea is to compute when a state change will occur, and only update state at time of the first state change, which can help save computing power. The problem is I have to implement predictive physics. And I'm fine for simple stuff (collision detection, basic collision responses, motions of isolated bodies) but I'm facing a big problem when it comes to more complicated interactions, especially constraint-like behavior.

I also made, few time ago, this post on physics.stackexchange

Problem restrictions

In my case, I restricted physics a lot in order to keep predictive collision detection simple:

Bodies have no rotation allowed, only translations.
Bodies have no animation allowed, they will not change shape over time.
Bodies are rigid, so they don't have any deformation.
Body can only be "roughly" shaped, they will never feature curves, only faces (even tho they can have lots of faces)

Problem: computing accelerations of several bodies constrained together

In order to achieve efficient a priori collision detection, I need to work with both speed and acceleration.

I have a collection of bodies, all in "possible" contact by pairs (their relative speed two by two is 0 on at least one direction).

Each of these bodies have a "initial" net force assigned, coming from interactions from bodies outside the collection for example.

I would like to allow theses bodies to have several relations between them, expressing how they should behave to each other. Relations may be:

constraints over acceleration for one body (example: no acceleration, or no acceleration along a certain direction)
constraints over relative acceleration for a pair of bodies, as non penetration constraints or stickiness.
forces opposing to relative movement of a pair of bodies, as friction

Finally, my goal to compute for each of these bodies the "final" net force satisfying constraints.

Example

The player (square on the pic) is pushing several boxes, with a triangular shape. Those boxes will "push" each other away, while still dragging along a bit their neighbors.

What I've tried and what I'm looking for

For now I try to focus only on non-penetration constraints

First, I've tried to find an iterative approach, based on a graph representing interactions between objects, propagating base net forces through bodies one after another, and then "giving back" forces when a new force arrives on a body, but it quickly gets too complicated to picture, and I expected algorithmic complexity to be way too high anyways...

The problem feels like there is an equation system to solve somewhere.

Then, given this post, I tried to adapt it to my problem, but I don't know how to model non-penetration constraint, since I didn't found a way to express it other than one looking like an inequation between acceleration of a pair of object: \$ a1 - a2 >= 0 \$.

Therefore, I would appreciate a lot to get some help with either:

My entire problem obviously
Only non-penetration constraints
Advises on understanding how to model "constraints" to balance other forces
Any other ideas (I feel so lost)
Advises to improve formulation of this post

EDIT : Found a solution based on linear programming, I will take some time to check it's robustness and then will add it as an answer to the post.


texts: How do I manipulate the Url of my Silverlight testpage.aspx?

texts:
I am making an XNA game using Silverlight over the web. My testpage.aspx is linked to from a previous page where the client selects certain elements. The testpage.aspx URL changes depending on what I have sent to it. Now in my mainpage.cs file I would like to call certain functions depending on what was passed, but I am unsure how to manipulate or even access the URL. Is there a specific class in the Silverlight library I can use?

Thank you for your time.


texts:
I want to be able to achieve spell effects that cause a fragmenting/discoloring effect on the sprite. The first couple seconds of this video http://www.youtube.com/watch?v=HNCFh7mkvuc shows what I mean. When the enemy gets hit by an electric attack, the effect I'd like to achieve activates (in yellow).

I'll have to use shaders to do this (if I don't, other, practical ways to do it would be extremely helpful). I have no idea where to start with a shader like this (beyond the obvious - using time and base color as parameters), and was curious if someone had something similar I could use as a base, or had a good idea where to start. I know the basic of glsl, but was hoping to spare myself some pain if someone has something like this already or could provide a starting point.

Any help would be appreciated,

thanks

Just to clarify, I'm looking to apply this against a 2D texture in OpenGL using glsl shaders


texts: Why is my diffuse lighting changing with camera position?

texts:
I am trying to do lighting in view space, but I am afraid I have an issue. I calculate the normals as:

N = norm_mat * vec4(vert_norm,0.0)

where norm_mat is the transpose(inverse(model_view_mat)).

Then in the lighting shader (for a directional light) perform the following:

N = normalize(N.xyz);
vec4 view_L_pos =  vec4(lightPosition.xyz, 0.0) * view_mat;
vec3 L = normalize(view_L_pos.xyz);
out_col = vec3(dot(N,L))

However, moving the camera changes the floor's lighting:

What am I doing wrong?


texts: Game launcher / updater download delta diff

texts:
I'm making a launcher for my game (using Unity3d).

I want it to have the following features :

Compare game version to latest version and update if necessary
Check files integrity and update if differences are found
Download/patch needed files

So comparing the game version is easy : I just parse a version.txt file and compare it's value to the latest server version.

Checking file integrity sounds easy too : Make a list of all files in the game folder, order the list, get a checksum and check if it corresponds.

Now here's the difficult part : Downloading the required files.

My first idea was : If a file checksum is different, download that file. But unity assets are compressed into large files, so even a simple change will lead to the download of a 2gb file...

So I'm now looking for a way do download only the different parts. I heard about VCDIFF / xdelta, apparently they can be useful to get a "delta patch" of different binaries. Cool. But how can I compare two folders if one of them is distant, without downloading it all before ?

Could torrent be an answer ? How are game/unity devs doing this ?

Maybe rsync can be useful, but is it safe if hundreds of clients are simultaneously updating using rsync ?
I heard about Unity's AssetBundles. Is that useful and is it ok to put ALL my assets in bundles ?
How would I display a progress bar in unity showing the rsync progression ?


texts: Is there a good reason I shouldn't use a java applet for a game?

texts:
I want to make a multiplayer browser-based game. The nice thing about using an applet is that I can make the client and the server in the same language (java/closure/scala/etc). I know there's html5 and javascript, but server side javascript isn't as mature as the jvm platform and browser support is still kind of flaky.

Applets don't seem to be widely used (except for Runescape), but is there a reason they're unsuitable or is it just because of the bad reputation they developed in their infancy?


texts:
I'm struggling on a simple project, as an example/sandbox, I'm rendering a small oscillating rectangle on my output. I'm not using glclearcolor() but instead, on every frame I draw a black rectangle before anything else, blending with: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
My goal is to see as I play with the alpha of this black rectangle feedback of previous frames, slowly fading, some kind of trail, and it's more or less working.
My main problem though, the trail never really disappears, and the longer I try to get the trail, the worse it gets. Also, I have to quite crank the alpha before seeing any trail, I don't really understand why.


texts: Textures created with Photoshop show up with a white border

texts:
All of a sudden, I started having this problem. I've used libGDX + Photoshop before and never had this problem. One of my textures is showing up with a white border/glow around.

The texture is the black blob on the middle, which is a 256 pixels png with a few black brushstrokes I created with Photoshop, just to test it.

Everything in libGDX is on default. I haven't changed the blending function, I'm just using a SpriteBatch to render the image without any changes.

The weird thing is, some other textures I created with Photoshop, same size, RBG 8 bit color mode (just like my blob image), look fine. These are temporary textures I created by downloading a png from the web, pasting it into Photoshop, applying a solid color overlay effect to it and saving it back as a png.

Any idea what's causing this?

Edit: Here's how I'm loading my textures:

private static Texture createTexture(String fileName, boolean maxQuality, Texture.TextureWrap textureWrap) {
    Texture result = new Texture(Gdx.files.internal(fileName), true);
    result.setFilter(maxQuality ? Texture.TextureFilter.MipMapLinearLinear : Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear); // TODO: Are these the best?
    if(textureWrap != null)
        result.setWrap(textureWrap, textureWrap);
    return result;
}

texture = new TextureRegion(createTexture("data/blob.png"));

I just found out using this technique that the transparent pixels in my texture are white (1, 1, 1, 0). So I'm pretty sure the cause is a combination of this, the linear resizing and probably the blending function. Not sure what's the right way to fix it though. Don't want to change the resizing to nearest.


texts: How can I implement world generation like in Don't Starve?

texts:
I am working on a game similar to Don’t Starve. Mechanics of the game are all also pretty similar. You craft things, you can explore a random open world and you need to survive. Because I really like the way Don’t Starve generates worlds with biomes, and this branch like structure:

I want my world generator to generate worlds similar to this on a large tilemap, with custom biomes, but I don’t think they use perlin noise for it.
Here you can see different biome sections of the game:

Also I want to explore other possibilities than noise to generate worlds, so I don’t want to use it for this project.


texts: Can various browsers be assumed to maintain predictible state accurately in multiplayer online gaming?

texts:
With many games it is said that server will assume that clients keep track of the world accurately. Assuming this is true, for a browser based multiplier space invaders game you would only tell the client when new bullets or the players ship moves and everything that behaves in a predetermined manner in the js client.

It would be expected that positions would be the same in the browsers. Do you think you could trust browsers to do this? I feel that timings could differ between rendering loops and cause positions to get out of sync and might just get the server to maintain all the positions to make sure.


texts: Simplified aerodynamics for 2d (top-down) airplane

texts:
I am writing a top-down 2d game, in which the player can control an airplane via the WASD keys. The W key should move the plane upwards (north), the A key to the west, and so on.

Now I need a simplified aerodynamics model to control the flight direction and speed of the plane. Pressing W should accelearte the plane a bit to reach full speed, then while the player continues to press W the plane should continue to move upwards on the screen (remember, top-down view).

When the player releases the W key and presses the D key now, the plane should behave similar to the real world. That is, it must not immediately move to the right (east), instead it should continue to fly to the north, but gradually start to move to the east. Then if the player continues to press the D key, the plane eventually has to fly solely to the east. So all in all in this example the airplane has to fly a curve from north to east.

In general the plane must not change its direction immediately and directly when the player presses another key, but instead fly using a simplified inertia (?) model. This should of course also work correctly if the player presses two keys at the same time, for example W (north) and A (west).

How would I achive this general in a 2d top-down game?


texts: How to get a difference of angles in one mathematical expression?

texts:
I need to do this for AI and also range calculation over a curved surface.

I have two angles, a1 and a2, which can be in the range from 0 to 359. I need to calculate the difference between them, and it has to be the inside angle (smallest angle), not the "reflexive" outside angle. And it has to preserve the direction from a1 to a2, which will be positive if going counterclockwise and negative if going clockwise.

Examples of what the function should yield:

scr_ang_diff(30, 50) == 20

scr_ang_diff(80, 310) == -130 // NOT 230 !!!

scr_ang_diff(130, 130) == 0

Now I could do this with test cases, but it seems there should be a way to do this in one mathematical expression. I can no longer use the simple min of abs of the two differences (without test cases) because that doesn't preserve direction.

EDIT: in order to differentiate between this post and this, I've decided to make it mandatory to preserve direction between a1 and a2.

Super bonus points if a1 and a2 can have range -359 to +359.

NOTE: yes efficiency matters. That doesn't mean you can't use trig functions, it just means I'll pick the least complex solution.


texts: Does SFML render graphics outside the window?

texts:
While working on a tile-based map I figured it would be a good idea if I would only render what the player sees on the game window, but then it occurred to me that SFML could already be optimized enough to know when it doesn't have to render those things.

Let's say I draw a 30x30 squared maps (A medium one) but the player only sees a bunch of them, not entirely. Would SFML automatically hide what the player doesn't see, or should I hide it myself?


texts:
I'm trying to figure out the purpose of the '@+' token in Angelscript, near the bottom of the page lists then as auto handles, and if I'm reading it right, then this in action would look like this:

Obj@+ ChooseObj(Obj@+, Obj@+);

void main()
{
    Obj@ A, B;

    {
        @A = new Obj();
        @B = new Obj();
    }

    // at this point A and B have a refcount of 1.
    Obj@ C = ChooseObj(A, B);
    //Let C = B, so A got decref'd and was deleted

    // this should be false, because the object's refcount was deleted,
    // but the pointer wasn't reassigned.
    if(A !is null)
    {
    //this should crash from an invalid pointer
        A.doMethod();
    }
}

Meanwhile, B got decref'd and incref'd, so it has a refcount of 1 when it gets returned, then gets addrefed again when it gets assigned to C. So C/B correctly has a value of 2, but that seems to be more a coincidence than anything.

In short I feel like I must be reading this wrong. What is it talking about?


texts: Problem with Rotating Third Person Radar UE4

texts:
I am doodling on the Flying game template on UE4. I am making a 2D radar on top left. Radar's north direction is the pawn's forward direction. So when it approaches to an object with the dotProduct value of 1, dot representing the enemy object on the map has to approach from direction (0, -1) on the coordinate system. Just like any shooter game.

My problem:

As I know, to calculate the x,y positions on the coordinate system with given angle and distance, the formula is as follows;

x = Cos() * dist, y = sin() * dist

As Unreal Engine's UI classes use top left as the pivot point, if an object is on absolute north of the origin on the screen, it has to come from (0,-1) as I wrote above.

Cos(270), sin(270) has to give 0,-1 and when I multiply with the distance, the dot has to be shown on absolute north of the origin point of the radar.

I declared two UProperties to play with the angles on the editor on runtime. When I enter 270, 270 for cos and sin values, it shows the dot as on the image below;

the closest to the top left is when I enter -90, 90 and it shows like in the image below;

Even if I am entering the incorrect values, I think at least an angle such as 90, 90 has to be perpendicular. Does anyone have any idea?


texts: Why when playing mixamo animation on my player the player ending and also while playing the animation inside the ground(terrain)?

texts:
The player have this components : Animator , Rigidbody ,  Capsule Collider , Third Person User Control , Third Person Character.
I just downloaded mixamo animation for my character player.
In my Animator controller I added a new state and dragged in the animation.
Without the animation the player is standing fine.  but with the animation the player is inside the ground.


texts: I want to be a game programmer and it's come to my attention that people who work in this industry are laid off/fired every few years. Can someone please tell me how to deal with this? Thanks


texts: How do I move Space Invaders like enemies in groups efficiently?

texts:
So like the title says I want my Enemies to move on a Grid like in Space Invaders. Say I have 8 rows and 12 columns. Now there are 10 Enemies in each row and there are 5 rows filled. In total I have 50 Enemies. Since I am using OOP I got 50 Objects. Now I want to shift all Enemies from left to right as far as possible. So if all Enemies are alive I can shift them 2 to the right and 2 to the left. If I destroy all Enemies in a column the Enemies can shift 3 to the left and to the right.

How do I check efficiently how many times I can shift over / check if a column is empty. How should I initialize the grid and shift all Enemies by one? For me this looks like it could get pretty laggy if I don't make it efficiently. Note: All Objects are dynamically allocated and I am using C++.

I hope I could make it clear. If you guys don't understand it, I could try to explain it a bit better.


texts: Approaching syncing between client and server, in a Tower Defense game

texts:
I am currently working on a Multiplayer TD, players can join games, and place towers on a map, so far so good.

This is how the game works as of today, when a new game is created, the server initialise a master game, basicly all logic happens here, it tell clients what to visualize. But this being my first MP game, i need some advice about how to keep players in sync with the server game, my questions could be.
"What to do, if a player looses contact to the server for several seconds, therefore getting out of sync"
"What to do, if a player plays with a poor internet connection, and having a latency jumping from 400ms to 3000ms"

I thought of sending data to each client 4 times every seconds, containing information for all entities on the board. This data i would then compare to the client data, and overrule entities that is out of sync, there would then be a tolerate value, so the users would't experience changes on the board, because of small game delays.

However i can imagine this would be a lot of work, and i wanted to ask if there was a smarter solution, i've looked at some post around the net, but could't find any which would apply for my game, feel free to throw links my way.


texts: Detect if mouse do multiple circle rotation around a XY point

texts:
would anyone know a method or algorithm (js) to calculate and detect if a mouse is moving by a circle around a target?
Example if a rotate mouse *4 time around a specific XY point, i would like to re-center my camera (in my context i need algoritme for a camera engine)

I search i little bit on the web, but no found good formula to perform this.

Maybe a will need a special api ?

thank.


texts: Box2d C++ x velocity slowing for no apparent reason

texts:
I'm making a 2d platformer in C++, using Box2d for physics and sfml for rendering, I want the player character to move with a constant velocity in the x direction, and to jump when the spacebar is pressed, maintaining it's x velocity. At the moment however, jumping slows the x velocity to a crawl, and falling large distances does the same

b2Vec2 jumpForce(120.0f , -500.0f);
playerBody->ApplyLinearImpulse( jumpForce, playerBody->GetWorldCenter(), true);

is how the impulse is applied when I want to jump, and

b2Vec2 moveSpeed(120,0);
playerBody->SetLinearVelocity(moveSpeed);

is the velocity the body is initialized with, I've turned both linear damping and friction to 0, but with no success.

If anyone has any idea how to solve this issue your help would be greatly appreciated.

edit: These are a couple of solutions I've tried

b2Vec2 jumpForce(playerBody->getLinearVelocity().x, -500.0f);
playerBody->ApplyLinearImpulse( jumpForce, playerBody->GetWorldCenter(), true);

b2Vec2 jumpForce(playerBody->getLinearVelocity().x, -500.0f);
playerBody->SetLinearVelocity( jumpForce, playerBody->GetWorldCenter(), true);


texts: Coordinates issue vertical scroll Libgdx

texts:
I'm going crazy with this problem. I'll explain:

I have a camera that falls down (flowing along the y-axis) which displays a TiledMap and declare the whole in this way:

In the create method:

map=new TmxMapLoader().load("Map.tmx");
this.renderer=new OrthogonalTiledMapRenderer(map);
this.camera=new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
this.camera.translate(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2);
this.camera.update();

In the render method:

this.renderer.setView(camera);
this.renderer.render();
camera.position.y+=1;
camera.update();

Then I have also a sprite drawing by SpriteBatch in the render method:

batchM.begin();
sprite.draw(batchM);
batchM.end();

In the tiledmap there are MapObject and I have to check if this objects hit to sprite and I do this so in the render method:

MapObjects collisionObjects =  map.getLayers().get("objects").getObjects();
        for(MapObject object : collisionObjects) {

               if (object instanceof RectangleMapObject) {
                   RectangleMapObject rect = ((RectangleMapObject) object);
                   Vector3 coo=camera.project(new Vector3(rect.getRectangle().x,rect.getRectangle().y,0));
                    com.badlogic.gdx.math.Rectangle Sprite= sprite.getBoundingRectangle();
                    com.badlogic.gdx.math.Rectangle Map=new com.badlogic.gdx.math.Rectangle(coo.x,coo.y,32,32);
                    //TEST
                   System.out.println("PLAYER X: "+Sprite.x+" Y: "+Sprite.y);
                   System.out.println("Object X: "+Map.x+" Y: "+Map.y);
                   if(Intersector.intersectRectangles(Sprite, Map, Sprite)) System.out.println("HIT");
          } }

My problem is that when I do not change the window size(remain the size the starting), collisions are detected fine, but when I change the window size (for example, I enlarge) collisions are not detected and I can not explain why.

Could you help me to fix this bug.
Thank you for your time


texts: Unity Help solving Uncaught Abort on HTML5 Build

texts:
For some reason there is a Invoke that is triggered when a button is clicked that causes my game to crash. Any idea how I can sort this out?

I have plenty other Invokes and none has given problems. I have the Enable Exceptions option set to None and game works fine inside Unity.

I can give more info on the error if you can point to me to what's relevant.
Thanks so much!

Invoking error handler due to
Uncaught abort(145) at Error
    at jsStackTrace (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22380)
    at stackTrace [Object.stackTrace] (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22551)
    at Object.onAbort (https://v6p9d9t4.ssl.hwcdn.net/html/1680115/PowerTheGrid_Level3_v7.2_HTML5/Build/3998187b7e8feaa618a93b293c0e6812.js:4:11065)

EDIT: Here is the code generating the error:

    public void OnClick()
    {
        if (buyCoal.interactable == true)
        {
                trainObject.trainMovementStart();

                if (SceneManager.GetActiveScene().name == "Level1" || SceneManager.GetActiveScene().name == "Level2")
                    Invoke("coal_refill", 6f);

                if (SceneManager.GetActiveScene().name == "Level3")
                    Invoke("coal_refill", 12f);

                Money.UseMoney(coalcost);
                buyCoalAudio.Play();
                countdown += 1; //agora é count up
                tipCoalReady = 2;
                buyCoalButtonIndex = 0; //DISABLE COAL Buy Button
                coal_stock_countdown.text = countdown.ToString();
                coaltipCounter += 1;
        }
    }

    void coal_refill()
    {
        ThermoElectric.quota += 17.5m;
        Invoke("reactivateBuyCoalButton", 5f);
    }
    void reactivateBuyCoalButton()
    {
        buyCoalButtonIndex = 1;
    }
}

}


texts:
I have a game that generates a random level map at the start of the level. I want to implement some way to save and load the level.

I was thinking maybe XML would be a good option for saving all the variable, then it would be easy for me to build something that can parse that XML and generate the exact same level.

But XML is probably overkill for my needs. I remember back in the day with the old Sega console that didn't have the ability to save your game (I think the Worms game did it too), that they would give you a bunch of character that you could write down. If you punched in that string later on, it would load the exact level.

Would a "level string" be a good option? Would it be some kind of "base60" conversion? How would I implement this?


texts: Why when adding audio foot steps to the character using animation events only one foot play the sound?

texts:
The animation in the Animator is HumanoidWalk In the inspector of the animation in the Animation tab at the bottom I clicked on the Events clicked to add event names the function as Step and moved the time slider to 0.67 moved the slider in the preview window of the character so the right leg foot will be close to the ground and clicked on apply:

Then I did the same but changed the time a bit more almost to 0.7 and called the function Step again and at the preview window now it';s the other leg foot close to the ground and clicked apply:

I added to the character in the hierarchy a Audio Source component and a script name Foot Steps:

And the script it self:

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

public class FootSteps : MonoBehaviour
{
    [SerializeField]
    private AudioClip[] clips;

    private AudioSource audioSource;
    private GameObject[] Foots;

    private void Awake()
    {
        audioSource = GetComponent<AudioSource>();
        Foots = GameObject.FindGameObjectsWithTag("Foot");
    }

    private void Step()
    {
        AudioClip clip = GetRandomClip();
        audioSource.PlayOneShot(clip);
    }

    private AudioClip GetRandomClip()
    {
        return clips[UnityEngine.Random.Range(0, clips.Length)];
    }
}

In the Hierarchy in the script in Clips I added same 8 audio clips just for the testing I could add only 1 it doesn't matter:

When running the game I marked with blue circle only this foot play the step/s sounds. And if I change the time to be the same 0.67 it will play two sound the same so it will sound like one or if the time is 0.67 and 0.7 it will hear two steps but only on the left leg foot.

The second leg foot never play the sound no matter how many times I changed the preview animation legs.

I tried to follow the instructions of this tutorial but no success:

Add foot steps tutorial

Should be simple but only one foot is working. I can't figure out what am I missing.


texts:
I am trying to achieve a grid movement for a character and enemies. This is what I have so far.

public float moveSpeed = 5f;

Rigidbody2D rb;
public Animator animator;

Vector2 movement;

private void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

void Update()
{
    animator.SetFloat("Horizontal", movement.x);
    animator.SetFloat("Vertical", movement.y);
    animator.SetFloat("Speed", movement.sqrMagnitude);
}

private void FixedUpdate()
{
    rb.velocity = movement;
}

public void MoverHaciaDelante()
{
    movement.y = 1 * moveSpeed;
}

public void MoverHaciaAtras()
{
    movement.y = -1 * moveSpeed;
}

public void MoverHaciaDerecha()
{
    movement.x = 1 * moveSpeed;
}

public void MoverHaciaIzquierda()
{
    movement.x = -1*moveSpeed;
}

public void Parar()
{
    movement = Vector2.zero;
}

And on the part of the enemies I carry this movement system.

private Animator myAnim;
private Transform target;

[SerializeField]
private float speed;
[SerializeField]
private float maxRange;
[SerializeField]
private float minRange;

void Start()
{
    myAnim = GetComponent<Animator>();
    target = FindObjectOfType<Player>().transform;
}

void Update()
{
    if(Vector3.Distance(target.position, transform.position) <= maxRange && Vector3.Distance(target.position, transform.position) >= minRange)
    {
        FollowPlayer();
    }
}

public void FollowPlayer()
{
    transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime);
}


texts: How can I simulate objects floating on water without a physics engine?

texts:
In my game the water movement is done in a shader using Gerstner equations. The water movement looks realistic enough for a school project but I encounter serious problem when I wanted to do sailing on waves (similar to this). I managed to do collision with land by calculating quad's vertices and normals beneath ship, however same method can not be applied to water because XZ are displaced and Y is calculated in a shader :(

How to approach this problem ?
Is it possible to retrieve transformed grid from shader?
Unfortunately no external physics libraries can be used.


texts: How do I create game rooms using Kryonet?

texts:
I'm currently about to create my first networking game, and it's supposed to be two player and turn-based. I wrote the client using the LibGDX library, and the server with Kryonet.

It should be possible for multiple users to play the games, at once, I feel the need to create something like a "game room". I thought about creating a class with two connections (the two players), adding a listener to each, and to handle the messages within the game room.

However, I am not sure how to permanently update the game rooms. At the moment, my server only listens for new connections, and registers them in a list of connected clients. Maybe, I should create a new thread for each match?

How do I create such game rooms within the game server, itself?

Edit:

So after doing some more research, this is how I currently do it:
- I store the players, that are currently searching for a game in a LinkedList (more precise, their Connections) and once there are more than two, I do this in my Server class:

if (connectedPlayers.size() >= 2) {
            GameRoom newGame = new GameRoom(connectedPlayers.removeFirst(), connectedPlayers.removeFirst());
            gameRooms.add(newGame); //some list, storing all the current games
            newGame.start();
}

and my GameRoom looks like this:

public class GameRoom implements Runnable {
Thread t;
Connection playerOne;
Connection playerTwo;
//more variables your GameRoom might need

public GameRoom(Connection playerOne, Connection playerTwo) {
    this.playerOne = playerOne;
    this.playerTwo = playerTwo;
    //whatever more variables you need to use can be declared here, e.g.
}

@Override
public void run() {
    while (true) {
        //Game logic goes here
    }
}

public void start() {
    t = new Thread(this);
    t.start();
}

}
I am not really into threading and this is what I set up after a little more reading into that topic, but I assume this is not really scaleable - because 1000 games would mean 1000 more threads, which I think is not so good.
Please let me know, whether this is the correct approach and if not, just stick to my question and help me with it, if you can and feel like it.


texts:
I've made my first game, in Unity, and I want to upload it to MediaFire.

I'm not sure what to upload. Should I upload the whole project, or is a certain part enough for someone to play it?


texts:
We all read job vacancies via the internet like GitHub jobs or StackExchange Careers 2.0 for example. You know, web app development, iOS/Android jobs and many other things. We even read about jobs ads in Google, Apple or any other big company.

Why don't we read about "Game Developer" vacancies? Is the demand for game developers so low? Or are game developers really rare?

How are companies like EA, Konami or Activision are getting their developers?

How can I overcome this response to an application: "You can't work for us because you don't have experience in developing games." How am I supposed to get experience if I'm not able to work in the field?


texts: libGDX - Scene2d Actions or Frame Animation, which is better for performance?

texts:
I only use Scene2d for the UI layer of my libGDX game. But I need some animations like fading or rotating on my players.

Which is better for performance:

Scene2d fade action or having multiple frames with different opacity and using them in the Animation class?

Also scene2d rotate action or having multiple frames with different angle?

Thanks!


texts: Unity 2D Cinemachine weird behavior for non rectangular confiner

texts:
I have been trying to emulate a sort of Megaman X4 way of following the player around platforming levels, where the camera is confined to certain boundaries of such levels.

However, all the tutorials and guides out there only show rectangular or square-shaped confiners for the virtual cameras, and not odd shapes like an L shaped confiner, when using a weirdly shaped confiner the camera just tends to snap from one position to another and the game ends up feeling bad when that happens.

I have tried solving this problem by using dolly tracks, which work nicely... But I end up having tons of virtual cameras to change to on sections that are weirdly shaped since the camera ends up also suddenly snapping on to weird positions on sharp turns and it also tends to get way off track, even when the settings of the virtual camera are configured to have very little damping and if there's no damping the camera just stutters all the time.

Is there a way to have this kind of behavior to confine a virtual camera to oddly shaped level boundaries?


texts:
I need to be able to efficiently render a tilemap which can be constructed this way:

There is one non-transparent base layer

Then there can be 3 partially-transparent layers on top of it. Each tile consist of tile texture + alpha texture.

I do not know much about rendering tile maps but I do have some knowledge of using shaders in Unity. I know something about control texture technique and about texture atlases.

I have about just 50 textures so I could easily put them all in one texture atlas 2048x2048 which most devices (even mobile) support today.

Also I have one animated texture (sea), so chosen approach should consider that.

What I don't know is how I should generate my mesh (two triangels per tile?) and which data exactly I should pass to my shader and how to do rendering there. Everything considering that there is 4 textures + 3 alpha textures per tile and they should be strictly ordered when rendered.