texts:
I'm trying to display 16x16 pixel art textures (all textures have 16x16), but they are not displayed how I expected (they are kind of blurry). I have seen this question before question, but this was not answering my question.

My approach:

I use the resize from this url webglfundamentals

Which means my canvas has the following properties :

width:100vw
height:100vh

Then I set my viewport to:

gl.viewport(0,0,gl.canvas.width, gl.canvas.height)

For the sprite rendering I use a orthographic camera:

function ortho(out, 0, gl.canvas.width, 0, gl.canvas.height, 0, 1) (from glmatrix)

The sprite I'am trying to display consists of this vertices :

new Float32Array([-0.5, -0.5, 0.0, 0.5, -0.5, 0.0, -0.5, 0.5, 0.0, 0.5, 0.5, 0.0]);

which means it is very small, so I scaled them up.
I understand that my original texture has only the size 16x16 and when I scale it up it gets stretched. So my question is how would you setup the viewport and why? (Also an explanation would be nice, since I have the feeling I did not quite understand the connection between viewport, orthographic camera and width and height of the canvas).


texts:
I am trying to create a glittering effect for my realtime shader but I don't know how.

Here is one example, and another example.

What technique can I use to implement this?


texts: Attach (Child)Rigidbody TO (Parent)Rigidbody let it collide with Tilemap

texts:
We want to attach a (Child)Rigidbody to another (Parent)Rigidbody
so that the (Child)Rigidbody is also transformed on (Parent)Rigidbody transformation.

The other constrain is that the (Parent)Rigidbody contains a tilemap also with collisions.

So we want the (Child)Rigidbody to:

inherits the (Parent)Rigidbody transformation when it is ON the (Parent)Rigidbody
collide with the tilemap ON the (Parent)Rigidbody
be able to leave the (Parent)Rigidbody and move freely in the world space.

During our tests, no game or physic-engine is able to do this.
Eg.

Box2d

is not able to transform a world
applying parent forces to the child gives inacurate results

Unity

"nearly" can do it with (Parent)Rigidbody->Static Tilemap
but transforming the Static Tilemap gives inacurate results.

Godot

"nearly" can do it, the same way as unity, but also gives inacurate results,
when moveing Static Tilemaps. Also some (already reported) physic bugs renders godot unsuited.

We already consider to build a custom physic engine, but this will be a huge task we like to avoid.

We are searching for a way to do this, if you know an physic engine that supports this please speak up :).


texts:
In Unity 2019.2 -LWRP (lightweight render pipeline project) the default Game Output(Quality = High) is rendering with jaggies.

Inorder to get a clear render ,while looking for the Anti-Aliasing option it doesn't seem to be under the default location (Edit-Project settings-Quality )for LWRP projects.

Where is the Anti-Aliasing option in LWRP and is there any other way to get a clear game render?


texts: Understanding webgl min/mag filter texture artifacts in orthographic projection?

texts:
Summary

Flickering and shimmering of image plotted on a geometry where the viewport exceeds the size of the screen. I am using an orthographic projection for the camera. In this case, it is tied to THREE's OrthographicCamera where the left,right,top,bottom parameters are -w/2,w/2,-h/2,h/2 and h=height of data and w=width of data.
I am rendering a geometry that is larger than the screen viewport, but with the left,right,top,bottom defined above as fitting to the dimensions of the data, the entirety of the data fits on the screen.
This geometry is broken into PoT tiles. I am using a LUMINANCE format for texture with a barebones fragment shader (the data itself is float32)
The view matrix is based on an orthographic projection where the frustum extends to the extent of the geometry (so the entire geometry is in view)
I have both enabled/disabled mipmap generation and have seen the same results below

Issue

For sufficiently large geometries (often 10-100x larger than the viewport) this causes some annoying artifacts that cause the texture to "shimmer" effectively changing the visual representation of the data.

Examples

Here is an example where the camera is panning down the Y-axis (down) in very small values relative to the viewport dimensions and you can see the texture actually appear to change:

This aliasing effect is definitely apparent in datasets like the one above (a raster plot of a signal)

Here is a second example that shows it a lot more.

My suspicion is that this is an artifact of the minfilter when there are many texels per pixel. What the heck is going on here!?


texts:
I've been extremely interested in volumetric technology, especially for grass.

Online resources are extremely scarce on this topic.

What is the difference from creating a lot of mesh billboards?
Is this shader based technology or simply a geometry type of generator?
How do I create something like this?


texts: How to update indices for dynamic mesh in OpenGL?

texts:
So I am making a 3D batchrenderer for my engine, and the basic concept is that we make large enough VBO and IBO to accompany all the vertex data(positions, normals, uv etc.) and update the VBO using glMapBuffer or using glbuffersubdata everyframe if we want to make any changes, but in this case the pattern of the IBO (Index Buffer) is predefined (i.e. we assume we have quads and fill it with 012230 for the entirety of the IBO size) but when using 3D models this won't be the case the IBOs data would be different, so how do I change the IBO data if I instantiate a new model or suppose if I am generating a UV sphere and want to change it's subdivisions?
I have no idea how to deal with dynamically changing(need not be frequent) indices data when using VAOs,  VBOs and Index Buffers.
As per OpenGL 4.5, core profile, reading from client memory is unsupported (§10.3.10 OpenGL 4.5 core spec):

DrawElements, DrawRangeElements, and DrawElementsInstanced source their  indices  from the  buffer  object  whose  name  is  bound  to
ELEMENT_ARRAY_BUFFER, using  their indices parameters  as  offsets  into  the  buffer  object  in  the  same  fashion  as  described  in  section  10.3.9. [...] If zero is bound to ELEMENT_ARRAY_BUFFER, the result of these drawing commands is undefined.

so we cannot map the ELEMENT_ARRAY_BUFFER using glMapBuffer or glBufferSubData (or can we?), and glDrawElements does accept a pointer to indices data but only when we are not using VAOs and VBOs, if we are using them it takes the last argument as a pointer offset in the currently bound ELEMENT_ARRAY_BUFFER.
So what's the best way to deal with dynamic indices?


texts: Show the progression of a loop in GameMaker Studio

texts:
I'm using a loop to destroy some objects in my code.

for (var i = 0; i < instance_number(obj_item); i++)
{
    var inst = instance_find(obj_item, i);
    with (inst)
        instance_destroy();
}

I would like to make them disappear one at a time on screen (i.e., the first one disappears, one second after that the second one disappears, etc.).

However, it seems that the screen is updated only when the loop has finished: all objects disappear at once.

In Unity, I would use coroutines for such a situation. How do I do that in Gamemaker?


texts: Simple Car Animation Acceleration Too Slow

texts:
I am trying to make a very simple car animation where using the arrow keys, I can make a car move around. I am using wheel colliders and some code that goes like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Car_My : MonoBehaviour
{

    public float Motorforce, Steerforce, Brakeforce;
    public WheelCollider FR_L_Wheel, FR_R_Wheel, RE_L_Wheel, RE_R_Wheel;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

        float v = Input.GetAxis("Vertical") * Motorforce;
        float h = Input.GetAxis("Horizontal") * Steerforce;
        print(Input.GetAxis("Horizontal"));

        RE_L_Wheel.motorTorque = v;
        RE_R_Wheel.motorTorque = v;

        FR_L_Wheel.steerAngle = h;
        FR_R_Wheel.steerAngle = h;

        if(Input.GetKey(KeyCode.Space))
        {
            RE_L_Wheel.brakeTorque = Brakeforce;
            RE_R_Wheel.brakeTorque = Brakeforce;
        }

        if(Input.GetKeyUp(KeyCode.Space))
        {
            RE_R_Wheel.brakeTorque = 0;
            RE_L_Wheel.brakeTorque = 0;
        }

        if(Input.GetAxis("Vertical") == 0)
        {
            RE_L_Wheel.brakeTorque = Brakeforce;
            RE_R_Wheel.brakeTorque = Brakeforce;
        }
        else
        {
            RE_R_Wheel.brakeTorque = 0;
            RE_L_Wheel.brakeTorque = 0;
        }

    }
}

When I do this, the car moves but it accelerates too slowly. I changed all the values but I cannot get it to start at a faster speed. Any help is highly appreciated.


texts: XNA change a specific color of a model to another

texts:
Is it possible to change a specific color of a model to another?

Example:

Everything that's blue should be red or something like that.

And is it possible to do this without the use of effects? I still want to use the basic effect.


texts: HLSL postprocessing for day to night (DTN)

texts:
I am trying to implement a "day-to-night"-filter (as commonly used in cinema) for a 2D game (XNA) by using a full screen HLSL pixel shader. The aim is to transform any bright and colorful image into a dark and bluish night version of that image somewhat like:

Conceptually, my ideas would be to:

Decrease brightness
Merge blueish tinted greyscale version of image with original image
Increase contrast

The current shader I came up with is:

// Look up the color of the original pixel
float3 colorOriginal = tex2D(TextureSampler, texCoord);

// Get corresponding greyscale value (adjusted to human vision)
float greyscale = dot(colorOriginal, float3(0.3, 0.59, 0.11));

// Merge and tint
color.rgb = lerp(colorOriginal, colorOriginal * float3(pow(greyscale,6), pow(greyscale,6), pow(greyscale,3)), timeFactor);

The result is still not completely satisfying. How could I improve this?


texts: How do I spread a LookAt rotation over 3 bones with different percentages?

texts:
I'm trying to rebuild the RE4 controller.
At first, I thought that only the chest bone is used to rotate the pistol towards a target.
I have then however found a hack to put the camera in a fixed position so that I could actually see the bone rotations.
Juding the logic that I have recorded, I believe that first a LookAt rotation is used, and then this rotation is spread over the abdomen, abdomen2 and chest bones.
Looking at the video that I have recorded, I think that the rotation is not "divided by 3", but procentually and then again changing towards the limits (for example, at the limits, the rotation is mostly done only by the chest).
Can anybody tell me if my judgement is correct, and if yes, how to split a rotation this way?
Would this be correct?
-->
The chest bone moves the most, the abdomen2 less, and the abdomen bone moves the least.
In percentages:

chest bone: 60%
abdomen2 bone: 30%
abdomen bone: 10%

Let's assume a rotation of 200°.
Am I right to assume that the rotation of each bone is calculated like this?
Chest bone:
Gets 60% of 200°, that is 120°
Abdomen2 bone:
Gets 30% of 200°, that is 60°
Abdomen bone:
Gets 10% of 200°, that is 20°.
Thank you!
ps:
Here are a few screenshots, but it's much easier to estimate from the video:


texts: How can I color single triangles with a color palette?

texts:
My primary goal is to have a lowpoly rendering style, so that each triangle has its own homogeneous color on all its fragments, meaning color is not interpolated between vertex.

I have my indices buffer with 4 values: 3 integers indicating the vertex index, and one ubyte indicating the color index from a 1D texture, which is just an array of 256 24bits colors in a vec3.

Is it possible to do this with opengl3.3 in core profile?

Do I need glVertexAttribDivisor? I'm not sure I really understand what it does exactly.

I've also heard about flat shading, but I don't know exactly how I could do it. I could also set a color per vertex, but triangles would share vertices, so it doesn't seem like a solution.


texts: How can I change the list of enum options displayed in the inspector?

texts:
I have an array of enums:

using UnityEngine;

public class EnumsInInspector : MonoBehaviour
{
    [SerializeField]
    public EnumType[] myEnums = new EnumType[3];

    public enum EnumType
    {
        A,
        B,
        C
    }
}

I want it so that if the enum at index 0 is B, then when selecting the enum at index 1, only A and C are options, and B is no longer available.  How can I achieve this?


texts: Instantiate objects in a List and use it

texts:
Why does the following code not work?

I want to instantiate prefabs in a list and then use  it as a GameObject like that :

public GameObject prefab;

void Start()
{

 ArrayList players = new ArrayList();

  for(int i=0; i<5; i++)
  {
        players.Add( (GameObject)Instantiate(prefab));
  }

  players[2].transform.position = new Vector3(1, 1, 1);

}

there is an error message


texts: Is game maker studio actually flexible enough to cater to an avid programmer?

texts:
After I got burned by RPGMaker which seemed fine what with the semi-open Ruby-like engine until you encountered some nasty surprises like the draconian resolution limitations etc., I've become more cautious.

I've heard a lot of good things about Game Maker and that it is now more flexible towards developers who actually want to get into the nitty gritty and push the limits, but I've also read that their scripting language GML isn't yet capable of things like object oriented design patterns.

I don't really want to get burned again by spending cash on something that may possibly not meet my expectations, and I feel I might be suckered in by the pretty wrapper.

That being said, while I'm feeling currently more comfortable in Java, the question about whether or not libraries such as libgdx and slick2d can offer me more freedom than game maker would be silly and rhetorical, instead what I ask is, is Game Maker currently up to snuff to hold a candle to more-programming-oriented libraries such as libgdx or slick2d?

Also, if I try out the free version of game maker would it accurately reflect the possibilities and perhaps even the limitations of the full priced product?


texts: How to create a simple "spot light" effect with Sdl or Sdl.Net?

texts:
i'm wondering: how to create a simple "car headlight" (for i.e) or a torch spotlight in Sdl or Sdl.NET ?
Does anyone know how ?
Thanks


texts: What are some typical server/vps/colo hosting costs for deployed MMOs?

texts:
From my estimates the MMO I'm designing can support 500000 concurrently connected non-idle users (and still be able to you know, do stuff) for about $1700/month in total hosting costs (includes bandwidth). No system admin is needed as the infrastructure auto-scales. Each additional 40000 users costs another $136/month. I've spent several months designing this backend and I'm curious how much other such systems cost.

I should note that this does NOT include the cost of any assets used by the client game. Assume it's an iPhone game with bundled assets.

Thanks!


texts:
First of all: I'm relatively new to Blender.

I discovered a weird bug in Blender 2.78c. On my object some textures are stretched although they are UV mapped. Since I have no clue why this is happening I took some screenshots which hopefully explain the problem.

I tried various things, but found no way to solve this. Things I tried:

Unwrap again
Apply Rotation and scale
Manually adjusting verts in UV map
Looking for "dead" verts somewhere in the model

Does anyone know this strange behavior?

Edit: I uploaded my .blend file -> http://pasteall.org/blend/index.php?id=47124 | merged screenshots due to low reputation :P


texts:
I've been reading up on a lot of articles covering data driven design for games. It seems to come down to:

No hard coding
No game-specific code in the engine
Scripting for AI, cutscenes, et cetera.
Generalizing code for reusability
Component design
Modularity
Low coupling
Editors (for data, maps, scripts)
External data retrieval
Constants kept in text files (.ini or otherwise)
Expose data through editors for scripting and manipulation by designers

Now, my question is, is this understanding correct?


texts:
In the past, I've used simple systems like finite state machines (FSMs) and hierarchical FSMs to control AI behavior.  This pattern falls apart very quickly or any complex system.

I've heard about behavior trees. They seem like the next obvious step, but I haven't seen a working implementation or really tried it yet.

What other patterns can make complex AI behaviors manageable?


texts: Is there a way of changing speed of an object at certain time? I want to change my speed to my initial speed after colliding with any object. I have already added bounce Physics to my colliding objects and player object with Friction set to 0. Please help.


texts: How to round points to an arbitrary grid on the surface of a cube?

texts:
I'm making a PCG game where I have points scattered or projected onto the surface of a cube, which is centered on origin with a "radius" of 1.

That surface is a grid and I want to associate each point to the center of each proper cell's grid.

After detecting which face the point is by taking max(x,y,z) I used that formula:

halfTileSize * floor (3dpositions * gridDivision)/gridDivision;

[EDIT: everything above work, everything below is useless, the problem was outside influence from obsolete code]

But it doesn't round the point to the correct grid cell on the surface. There is a problem where front and back don't return the same result, or it skips a row with some condition, and it also rounds to the wrong nearby cells.

I tried to replace the floor with:

3dpositions.xyz < 0 ? ceil(3dpositions * gridDivision) : floor(3dpositions * gridDivision)

That didn't work either. It seems to work fine on a 2d planes, which I used to conceptualize the formula, but in 3D I'm at loss as to why it wouldn't work, since I basically reduce the problem to 2D anyway...

Any help to create a formula that would round the points properly into the right cell?


texts:
is the concept for Tetris in the public domain or is there someone who is still collecting royalties on the concept? I mean, if I were to write a variant of Tetris would I owe somebody some money?
Thanks.


texts: Prevent feet from moving for a Unity character from a Mixamo animation

texts: So my question isn't about root motion, but rather just keeping the feet in place on the ground for a Mixamo animation... I tried to just delete the feet and toes in avatar configure, but nope... I am wondering if there is some sort of simple way to have an animation affect all but the feet?


texts: How to move an image back and forth with javascript

texts:
I currently am trying to make a baseball game and have this code here: http://jsfiddle.net/769BK/ I have the baseballX set to a decrement, and then I try increasing the value using baseballX++; but it won't stop the baseballX--; after that so it stays in the same place. I need to somehow stop the baseballX--; and that way I can use baseballX++;

Thanks for any help at all!


texts: Texture Region drawing issue with LibGDX

texts:
I am currently moving my old slick2d project to libgdx. I have created a custom AnimationExt class that extends Animation to which I added a draw method. The Animation's frames are actually TextureRegion so I draw current frame TextureRegion. Here is the code, it's pretty simple.

    public class AnimationExt extends Animation {

    float stateTime=0;
    TextureRegion currentFrame=null;
    boolean isStopped=false;

    public void draw(SpriteBatch batch,float x, float y,int originX, int originY, float xscale, float yscale, boolean hMirror, boolean vMirror, float angle, boolean clockwise){
        if(isStopped==false){
            stateTime += Gdx.graphics.getDeltaTime();
            currentFrame=getKeyFrame(stateTime);

        }else{
            currentFrame=getKeyFrame(stateTime);
        }
        batch.draw(currentFrame, x-currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,currentFrame.getRegionWidth(),currentFrame.getRegionHeight());
        }

    public AnimationExt(float frameDuration,
            Array<? extends TextureRegion> keyFrames, int playType) {
        super(frameDuration, keyFrames, playType);
    }
}

This code works well. BUT when I add parameters to the batch.draw method (originX, originY, scaleX, scaleY, angle, clockwise) like this:

batch.draw(currentFrame, x-currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,originX,originY,currentFrame.getRegionWidth(),currentFrame.getRegionHeight(),xscale,yscale,angle,clockwise);

The drawing method goes crazy: it draws the texture rotated to -90 (whereas the angle I entered was 0) and it the width and height are inverted. To fix this I had to do change the code like that :

batch.draw(currentFrame, x+currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,originX,originY,currentFrame.getRegionHeight(),currentFrame.getRegionWidth(),xscale,yscale,90+angle,clockwise);

But I don't want to keep this code as I'm pretty sure it's weird and I want to know why does the drawing method have such a weird behaviour when adding more parameters.
By the way, I'm using the very last nightly builds of 17th June.


texts: Circle Collider 2d is slipping off box colider2d when it shouldnt

texts:
I have a crude rectangle sprite with a box colider 2d, and a circle sprite with rigidbody 2d and circle collider 2d, as seen in the image below. When I click on the red rectangle, it moves up fairly quickly a little more than the diameter of the circle.

If this occurs from the position show, or with the circle any further right than it currently is, the circle appears to fall down onto the yellow box almost instantly, hugging the side of the red rectangle. If I let the circle go a little more onto the red rectangle then it is pushed up correctly. Why is the circle falling off the red rectangle from this position, and how can I prevent it from acting like this?


texts: In Box2D, what exactly does a fixture represent?

texts:
In Box2dWeb, when we create a body we attach a fixture to the body object.
We make the shape, friction, restitution and so on by tinkering with the fixture object.

So from this can we conclude that the fixture is what we really need to tinker with to get the body we want, and the body object we create just an abstract entity? Abstract in the sense that by itself, it is invisible in the canvas after we draw and animate the canvas? The body is just the abstract, formless object that becomes physical once we attach the fixture. Is this right to conclude?


texts: Java - Tile engine changing number in array not changing texture

texts:
I draw my map from a txt file. Would I have to write to the text file to notice the changes I made? Right now it changes the number in the array but the tile texture doesn't change. Do I have to do more than just change the number in the array?

public class Tiles {

public Image[] tiles = new Image[5];

public int[][] map = new int[64][64];

private Image grass, dirt, fence, mound;

private SpriteSheet tileSheet;

public int tileWidth = 32;
public int tileHeight = 32;

Player player = new Player();

public void init() throws IOException, SlickException {
    tileSheet = new SpriteSheet("assets/tiles.png", tileWidth, tileHeight);

    grass = tileSheet.getSprite(0, 0);
    dirt = tileSheet.getSprite(7, 7);
    fence = tileSheet.getSprite(2, 0);
    mound = tileSheet.getSprite(2, 6);
    tiles[0] = grass;
    tiles[1] = dirt;
    tiles[2] = fence;
    tiles[3] = mound;

    int x=0, y=0;
BufferedReader in = new BufferedReader(new FileReader("assets/map.dat"));
String line;
while ((line = in.readLine()) != null) {
        String[] values = line.split(",");
    for (String str : values) {
            int str_int = Integer.parseInt(str);
            map[x][y]=str_int;
            //System.out.print(map[x][y] + " ");
            y=y+1;
        }
//System.out.println("");
x=x+1;
    y = 0;
}
    in.close();
}

public void update(GameContainer gc) {

}

public void render(GameContainer gc) {
    for(int x = 0; x < map.length; x++) {
        for(int y = 0; y < map.length; y ++) {
            int textureIndex = map[y][x];
            Image texture = tiles[textureIndex];
            texture.draw(x*tileWidth,y*tileHeight);
        }
    }
}

Mouse picking

public void checkDistance(GameContainer gc) {
    Input input = gc.getInput();

    float mouseX = input.getMouseX();
    float mouseY = input.getMouseY();

    double mousetileX = Math.floor((double)mouseX/tiles.tileWidth);
    double mousetileY = Math.floor((double)mouseY/tiles.tileHeight);

    double playertileX = Math.floor(playerX/tiles.tileWidth);
    double playertileY = Math.floor(playerY/tiles.tileHeight);

    double lengthX = Math.abs((float)playertileX - mousetileX);
    double lengthY = Math.abs((float)playertileY - mousetileY);
    double distance = Math.sqrt((lengthX*lengthX)+(lengthY*lengthY));

    if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON) && distance < 4) {
        System.out.println("Clicked");
        if(tiles.map[(int)mousetileX][(int)mousetileY] == 1) {
            tiles.map[(int)mousetileX][(int)mousetileY] = 0;
        }
    }

    System.out.println(tiles.map[(int)mousetileX][(int)mousetileY]);
}


texts: How can the ball moving like billiard after collision with wall?

texts: I tried ball.velocity = Vector3.forward * speed and also *=-1 when the collision is occurred(It only works for straight way. But I want the ball movement be liked in photo. How can i do it? Thank you very much!


texts:
I have a 3D model that has a GLSL script, and I want to draw a line on each border of its polygons in the fragment shader.

What should I do? Note: I am using Ogre3D, so I can't use OpenGL's functions.

So far I have this (just assigns a texture to it):

void main(void)
{
  gl_FragColor = texture2D(texture1, gl_TexCoord[0].st);
}

This means if I have a cube, I want to render 12 lines, on each border of the cube


texts: Should I consider a graduate degree in game development?

texts: I am sure you guys can definitely help. Some universities, like NCSU, USC, UCSC for their master's, offer courses based on gaming and game development (some call it MS in Computer Science with an emphasis on game development). I am very interested in this field and I want to give it a shot. But since a master's degree is very costly I have to factor in the future prospects as well. I want to know if this a proper course when a career is also taken into account. Any opinions or ideas? Anyone who has followed this career line?


texts: How do I configure the clipping region when drawing with XNA's SpriteBatch?

texts:
I have a SpriteBatch that is set to draw to a RenderTarget2D that is 500 pixels larger in both height and width. Whenever I draw to a point outside of the physical screen dimensions, it will not draw the object.

I am performing some 3D transforms on the texture so I need the areas outside the screen to be drawn. I have tried setting culling to None and this had no effect.


texts: Surface creation algorithm using points cloud

texts:
I am looking for a realtime algorithm to create a 2D mesh using points. But I am quite confused. It seems that Delaunay triangulation can help me create mesh using point clouds, but Meta-balls seems also useful for isolated points for example. And what about concave shapes ?

I am looking for interesting links, white-papers, code sample, etc...

Here is an example of what I am trying to achieve. As you can see the aim is to create a 2D fluid surface.

In red should be the generated mesh, I tried to reproduce the special condition that could happen like concave shape, isolated points, etc. In black you can see the points used to create the shape.

Thank you.


texts: I've created some simple Phong shading code from a sample. The issue is that the sample only handles one light. If I wanted a variable number of lights set at the start of each frame, how could I specify in the effect file that I need to pass a variable number of e.g. light positions and etc to render from?


texts: Unity Android game all squashed in center of screen (portrait layout), help

texts:
I'm developing a demo for Android game in Unity with portrait layout. I used the ViewportHandler script found here (How do you handle aspect ratio differences with Unity 2D?) and it worked well. Yesterday I updated Unity (foolish move I know, two days before deliver of a project!!) to 5.4.2f2 (was using 5.4.1f1). I don't know if that is the reason but now I can in no way get my correct layout again. Sure, it is portrait but all squashed in the center and taking about one-third of the screen, rest just background camera-colour. Things looked well yesterday but now I'm in big trouble :(

Any help would be greatly appreciated!


texts: Why does changing Texture of Particle System using Material Property Block changes texture, but Particle System is still emitting old texture?

texts:
I try the code in Start, checking in Editor shows new texture, but Particle System still emits old texture. The script works for SpriteRenderer, but not ParticleSystem. I tried to Play/Stop emission - no difference.

    ParticleSystemRenderer renderer = gameObject.GetComponent<ParticleSystemRenderer>();
    MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
    renderer.GetPropertyBlock(materialPropertyBlock);
    materialPropertyBlock.SetTexture("_MainTex", texture);
    renderer.SetPropertyBlock(materialPropertyBlock);


texts:
Consider following example. I have a title screen for a game which displays top scores list, and some other text. The Update method looks like (simplified):

// remove all text
textList.Clear();

// add scores
foreach(var sc in scores)
{
    textList.Add(new GameText(string.Format("{0}: {1}", sc.Name, sc.Score));
}

If I understand all correctly, then each frame 10 new strings are created, polluting memory at high rate. Currently I fight it with creating a cache:

// this is a class level variable, outside of Update method of course
List<GameText> scoreCache = new List<GameText>();

// remove all text
textList.Clear();

// add scores to cache if needed
if(scoreCache.Count == 0)
{
    foreach(var sc in scores)
    {
        scoreCache.Add(new GameText(string.Format("{0}: {1}", sc.Name, sc.Score));
    }
}

// get fast copy from cache
// no new strings created until score cache is invalidated
textList.AddRange(scoreCache);

I wonder, if there are some other reliable solutions and patterns to this common, as I see it, problem?

Update. As @JasonH correctly mentioned, there is no need to update list each time at all, so now scoreCache is initialized once in a LoadContent-like method which is called once before main Game loop starts.

Update 2. Another similar problem was with a debug text layer output which displays FPS, Total game time, etc. on top of all screens. Despite using StringBuilder, intermediate strings were required for creation of final debug text for each frame. I've decided to solve it this way, since I don't actually need per frame response, I update this only each second:

private void PrepareDebugText(GameTime gameTime)
{
    this.refreshAccumulator += gameTime.ElapsedGameTime.TotalMilliseconds;

    // if required time is not elapsed yet
    if (this.refreshAccumulator < RefreshIntervalMs)
    {
        // do nothing
        return;
    }

    // reset accumulator
    this.refreshAccumulator = 0;

    // create debug text below
    // ...
}

Applying this two approaches gives following:

reduced garbage collection frequency by 2 (from 60-70 seconds to 130-140 seconds)
reduced peak heap allocation from 3,4 Mb to 1,5 Mb
reduced short life objects to less than 1% from more than 50%.

Now I'm satisfied.

Update 3. @GeorgeDuckett found an interesting approach example how we can further reduce string pollution then output is integer number.

I also would like to clarify why strings are so specific in XNA (.NET). Despite being a reference type, on each assign (i.e. =) operation new string is created instead of assigning reference. This can produce not very obvious amounts of garbage strings.


texts: Rendering a black and white image in OpenGL 1.1

texts: Is there is any way that I can simple disable the color in OpenGL 1.1? Or can I "grey out" textures in LWJGL?


texts: Hello World with FlashDevelop, Flixel, AS3: uneffective SWF macro

texts:
I just started with FlashDevelop and Flixel, and I already have a question. I created this basic hello world:

package
{
    import org.flixel.*;
    [SWF(width = "640", height = "480", backgroundColor = "#000000")]; //Set the size and color of the Flash file

    public class HelloWorld extends FlxGame
    {
        //...
    }
}

When I run this "game", using Flash Player, I get a 800x600 window with a white background, even though I specified it's 640x480 with a black background. Am I doing anything wrong?

I am using Flex 4.6.0, and the target platform is Flash Player 10.1. I have the debugger version of Flash Player 11 installed (WIN 11,5,502,146 to be exact).

In the .xml file (found in the obj folder) I found the following:

<default-size>
    <width>800</width>
    <height>600</height>
</default-size>

Changing the size/color through the properties window of my FlashDevelop project does work fine...

It seems to ignore the [SWF(...)] macro entirely: what's going on?


texts: What degree do you need to become a game designer,programmer,developer.etc

texts:
I was wintering what degree do you need in order to become a game designer,programmer or developer.
P.S i mean people who work for companies such as riot or ubisoft,etc


texts:
I there a point in updating the physics at a different rate than drawing / taking input? Is it just to exploit parallelism?

I've heard that many engines update the physics at 15FPS but render at 60FPS. What's the point in rendering the same image four times until it changes if it doesn't add fluidity?


texts: What does declaring a const float within a function do? (CGFX)

texts:
I've been working with this piece of code to get the mip map level that I should sample for a texture that I got off a forum somewhere. I noticed that they use a const float. Now from what I understand this would just immediately get discarded after the function was done, so if there was any performance gain here it would be hyper-small.

But I know that sometimes there is a lot of compiler magic that goes on in graphics programming languages, so I was wondering if the const declaration actually did matter (like, does it only calculate the value once and reuse that value for every fragment on the screen?)

        float MipLevel( float2 uv, half mipcount, half texturedim)
        {
            uv *= texturedim;

            float2 dx = ddx( uv );
            float2 dy = ddy( uv );
            float d = max( dot( dx, dx ), dot( dy, dy ) );

            // Clamp the value to the max mip level counts
            const float rangeClamp = pow(2, (mipcount - 1) * 2);
            d = clamp(d, 1.0, rangeClamp);

            float mipLevel = 0.5 * log2(d);

            return mipLevel;
        }


texts: Why do my animations need to be marked as "legacy?"

texts:
I'm in the beginning of a project and I'm not really using 3D models but rather a hierarchy of primitive shapes. I made a couple of animations that suddenly don't work anymore. I get an error about that I need to mark them 'legacy'.

I came across this suggestion to mark them as legacy in the rig tab via the model, but I'm not using a model so that doesn't help.

I don't understand how the animations that I made in Unity yesterday don't work today? What is this legacy problem?


texts: std::vector performance for pixel buffers

texts:
Doing software 2d pixel buffers, blitting, etc. Someone was telling me there's absolutely no overhead involved in using an std::vector to represent objects, I was wondering if std::vector is indeed a good container for pixel buffers or if I should instead stick with a raw array like I've always used.

Thanks


texts: Hello I made a simple game and I want to share it to my friend but he cant run it. I'm assuming it's because he has windows 10 and the LWJGL 2 native files don't support that (I've asumed that based on the .bat run file (a standard Java -jar a.jar line) wich crashed right before it is supposed to initialize windows 10). Maybe that isn't the problem but I don't see any other issue. Do the native files support newer systems? If not, then could you give me suggestions on getting new native files or something. Thanks


texts: Method for Modifying Numbers based on Attributes in a Game

texts:
A game that I'm working on in Unity has a diverse set of spells. The player character and NPCs all use an attributes which modify these spells in different ways. Our design is very fluid and the functions that modify these spells are continuously changing. As of now I've been hard coding the modifying function into the spell class itself while leaving different variables open for designers to modify it. Example for amount of missiles fired:

BaseQty + Strength * MissilesPerStrength

Leaving the BaseQty and MissilesPerStrength attribute open in the inspector for designers.

As our game balancing is changing so much I feel as if only leaving certain variables open isn't enough, as I'll have to go back and change the formula itself if required. I've thought about allowing designers to script the function itself, and for the spell class to get the number for (Example) missiles fired by interpreting the script, but I'm not sure how to go about doing this and in my mind it feels a little bit needlessly complicated for the small team that we are. It's not too much of a hassle to go into the class and change the formula, it just feels wrong not to have it separate.

I'm looking for critique and suggestions on my ideas if possible. Thanks for reading.


texts: Best way for first person view to look at a note/item and add it to inventory?

texts:
Implementation question from a beginner. I would like to implement a functionality to a first person game where the player can pick up notes lying around and have the note align itself to the camera and get bigger for the player to read its contents. The game will have a Myst like feel to it.

I am currently debating whether I should use the UI or just animate the note object in the game world itself and have it "fly" towards the camera.

So far I've implemented a solution which uses a raycast and when the ray hits an item it sends a message to it. If the item can understand this message, then it looks at the camera (using lookAt()) and becomes a child of the camera, I then reposition it in front of the camera using the localPosition.

All this seems to work fine but my object is still part of the world, I would ideally want it to be unable to collide with objects when it is carried around by the player. My plan was then to have a couple of UI button pop-up each time an item is picked up for the player to either drop it or stash it in its inventory.

Any suggestions ?

Thank you


texts: Issue in using Set Integer (by ref) in Unreal Engine 4.16 blueprint

texts: I am trying to set the value of an integer by reference in a macro created in my blueprint script. The macro does a simple conditional check of an integer and increments it if it is less than a max value. I was using one of the maze generating tutorials and the function throws a failed to resolve term Value passed into Target error. I am not sure why it cannot deduce the type of Value. The original tutorial was made in UE 4.6, so could it be due to updates made in UE 4.16? I have attached a screenshot of my blueprint.


texts: How do I rotate shoulder bone up and down using Rotate and Space.World independend on model orientation

texts:
I wanted to move my character's arms up and down in a straight way.
The Rotation Gizmo tool can do exactely that.
Playing with the wheel of the Rotation Gizmo tool in the attached screenshot (marked with red arrows in my screenshot), I could move the arms down in a straight way:

I can do the same using the following script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyPlayer : MonoBehaviour
{
    public Transform Shoulder;

    private Quaternion _Rotation;
    private float _f = 0f;

    private void OnGUI()
    {
        if (GUI.Button(new Rect(0, 70, 50, 30), "+"))
        {
            _f += 1;
            Shoulder.Rotate(_f, 0, 0, Space.World); ;
        }
    }
}

This works perfectly fine, but no longer when I rotate the main model (=the parent of the shoulder).
How could I make this script independend on the main transform's orientation?
Thank you!
Edit:
I would guess that I have to take the main transform (=parent) orientation into account in order to subtract its global rotation from the calculations, but not really knowing which values I should choose, I didn't find the correct formula. However, FYI, I tried the following:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyPlayer : MonoBehaviour
{
    public Transform Shoulder;

    public Transform Mother;

    private float _f = 0f;

    private void OnGUI()
    {
        if (GUI.Button(new Rect(0, 70, 50, 30), "+"))
        {
            _f += 1;
            _f -= Mother.transform.rotation.eulerAngles.x;
            Shoulder.Rotate(_f, 0, 0, Space.World); ;
        }
    }
}


texts: 2D Distance Field as collision handler method

texts:
Pixeljunk Shooter has really cool fluid simulation.

I found the dev's video explaining what they did. Here

I understand that it is particle based simulation Smoothed Particle Hydrodynamic

I can find adequate resources and even books covering this topic, but I can't find resources for the "collision"

All I can find about using distance field for collision are very tough article and some vague description

The second resource states

  Using a signed distance field then makes it very easy to check if a particle is colliding with our environment - simply sample the distance field at the particle position and if the magnitude of the distance is negative we have a collision (ignoring the potential for tunneling for the time being). Once a collision is detected we can then backtrack along the particle trajectory until we find where the particle collided with the surface. To calculate the collision response we then need to determine the surface normal - this is again easy as we simply need to calculate the gradient of the distance field and normalize the result.

Does it mean that I just backtrack my particle till it is no longer "inside the object"?
Then take average distance from surrounding, then take normalized average as "normal vector of the sourface"?

Is that "all" I need to do?

If such is the case, don't I need to render only "inside" of distance field? I don't need how close edges are when I am outside an object? Or do I need to know that as well?

I really need clear step by step teaching material in which I can really look at it and read it through to understand. Are there any resource that teaches this technique?


texts: How do I animate a biped model from 3ds max using XNA framework or not necessarily the biped model, it could be any 3D model but how can I code the animation?


texts: Calculating Per Vertex Normal in Geometry Shader

texts:
I am able to calculate normals per face in my Geometry Shader but i want to calculate per vertex normal for smooth shading. My Geometry shader is

#version 430 core
layout ( triangles ) in;
layout ( triangle_strip, max_vertices = 3 ) out;

out vec3 normal_out;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

uniform mat4 modelTranslationMatrix;
uniform mat4 modelRotationXMatrix;
uniform mat4 modelRotationYMatrix;
uniform mat4 modelRotationZMatrix;
uniform mat4 modelScaleMatrix;

void main(void)
{
    // Please ignore my modelMatrix and NormalMatrix calculation here
    mat4 modelMatrix = modelTranslationMatrix * modelScaleMatrix * modelRotationXMatrix * modelRotationYMatrix * modelRotationZMatrix;
    mat4 modelViewMatrix = viewMatrix * modelMatrix;
    mat4 mvp = projectionMatrix * modelViewMatrix;
    vec3 A = gl_in[2].gl_Position.xyz - gl_in[0].gl_Position.xyz;
    vec3 B = gl_in[1].gl_Position.xyz - gl_in[0].gl_Position.xyz;
    mat4 normalMatrix = transpose(inverse(modelViewMatrix));
    normal_out = mat3(normalMatrix) * normalize(cross(A,B));
    gl_Position = mvp * gl_in[0].gl_Position;
    EmitVertex();
    gl_Position = mvp * gl_in[1].gl_Position;
    EmitVertex();
    gl_Position = mvp * gl_in[2].gl_Position;
    EmitVertex();
    EndPrimitive();
}

Since i don't have access to adjacent faces here, i cannot calculate per vertex normals.
How can i calculate per vertex normals in my Geometry Shader?


texts: How can I set a Steam achievement in Steam via LibGDX or native Java?

texts:
Is it possible to set or 'unlock' a Steam achievement via LibGDX or with a native Java solution?

If so, how it this possible. Furthermore, what would be a good implementation for 'saving' achieved achievements when you were offline. For example, when I enable the airsafe mode on my laptop and then run the game, be really good at it and unlock an achievement, how can it be saved the next time I have WiFi?


texts: How do I resolve the error "Trying to send command for object without authority."?

texts:
I don't know what I did wrong I tried couple different ways from not using commands to using SpawnWithClientAuthority. But It either gives build and compile errors or just the Error in the title

Here the Start function of my player object

 void Start () {
    player = isLocalPlayer;
    race = Data.races[(int)selectRace].getInstance();
    clss = Data.classes[(int)selectClass].getInstance();
    health = race.Health * clss.HealthMultiplyer;
    speed = race.Speed * clss.SpeedMultiplyer;
    armor = race.Armor * clss.ArmorhMultiplayer;
    energy = race.Energy * clss.EnergyMultiplayer;
    skills.AddRange(race.RaceSkills);
    skills.AddRange(clss.ClassSkills);

        Data.entities.Add(this);

    Debug.Log(isLocalPlayer);

    if (!isLocalPlayer)
        return;
    int enID = Data.entities.IndexOf(this);
    foreach (Skill s in skills)
        s.CmdSpawn(enID);

}

And here is the spawn functions from skills I try to spawn

[Command]
public override void CmdSpawn(int enID)
{
    setEntity(Data.entities[enID]);
    Debug.Log("Spawned");
    dir = getEntity().lookingAt;
    gameObject.transform.position = getEntity().transform.position + dir * 0.65f;
    transform.up = dir;
    NetworkServer.Spawn(gameObject);
}

and

[Command]
public override void CmdSpawn(int enID)
{
    setEntity(Data.entities[enID]);
    dir = getEntity().lookingAt;
    transform.up = dir;
    dir = new Vector3(dir.z, dir.y, -dir.x);
    gameObject.transform.position = getEntity().transform.position + dir * 0.65f;

    NetworkServer.Spawn(gameObject);

}

If you can help, thank you ^.^


texts: Efficient existing rating system for multiplayer?

texts:
I would like to add a rating for online version of a board game. In this game there are many game rooms each normally having 3-4 people.

So I expect that player's rating adjustments (RA) should depends on

Rating of opponents in the game room
Number of players in game room and final place of a player
Person gets rating increase if he plays more games and more frequently
If a person leaves a game room (disconnect) before the game ends he should get punished with a high rating decrease

I have found two related questions in here

Developing an ELO like point system for a multiplayer gaming site

Simplest most effective way to rank and measure player skill in a multi-player environment?

Please, let me know what would be the most appropriate existing rating model to refer.


texts: (Unity) Spawning AI cars - weighted to ahead of camera?

texts:
I'm working on a little project where I drive around a small city with a top-down but slightly angled camera view (like GTA Chinatown Wars). Cars are instantiated from spawners that aren't in camera view, then destroy if they drive too far from the player.
To spawn a new car, I loop through all my spawner gameobjects and if they are within a certain distance to the player (and not in view of the camera), then they get added to a 'spawner' list, of which I pick a random.
The loop is something like this;
float dist = Vector3.Distance(player.transform.position, spawner.transform.position);
Vector3 screenPos = Camera.main.WorldToViewportPoint(spawner.transform.position);
bool inView = screenPos.z > 0 && screenPos.x > 0 && screenPos.x < 1 && screenPos.y > 0 && screenPos.y < 1;
if (!inView && dist < 15) { list.Add(spawner); }

This works, but I find that when I'm driving around barely any traffic spawns on roads ahead of me, maybe because the camera angle is removing a chunk of the possibility area.
Is there anyway to 'weight' it so spawners in the direction the camera (or beyond) have more chance of being picked, rather than ones behind me? In games like GTA Chinatown Wars you will be driving through rows of traffic, and I'm trying to get more density.


texts: The saturate function is not working in my pixel shader

texts:
I wrote a pixel shader for my game and when I tried to compile it an error occurred:

ID3DXEffectCompiler::CompileEffect: There was an error compiling expression

When I removed all the saturate functions from the shader it compiled without problems. Strangely the saturate function works for all techniques in this effect file but one.

This code worked for me:

float4 PixelShader(VertexToPixel PSIn) : COLOR0
{
    return xAmbientColor * xAmbientIntensity;
}

And this didn't work:

float4 PixelShader(VertexToPixel PSIn) : COLOR0
{
    return saturate(xAmbientColor * xAmbientIntensity);
}

-EDIT-

When I added some diffuse lighting the saturate function worked perfectly for the diffuse lighting calculation while it still didn't work for ambient lighting. This is really strange and I hope you can help me with this problem.


texts: Level Selector with possible future levels? [Unity]

texts:
I have a level select screen which is a simple grid layout of my levels. The level data comes from a scriptable object for each level.

The problem I have is what is the best method for populating the grid of levels that use the scriptable object and is able to add more levels to the grid layout if let's say I add an asset bundle in the future?

My thought was that I use a levelDB which holds a list of all of the scriptable objects. Then when an asset bundle is used then it adds the content to the levelDB. The UI would then just use this levelDB to populate the screen.

NOTE: I have very little to no knowledge of how asset bundles work and what you can, and cannot do with them.


texts:
Let's say I have a heightmap, but I want to create flat areas on it. The easiest solution would be to just say that every value between 0.2 and 0.4 should just become 0.3, but to keep the terrain continuous, I need to make sure that the values below 0.2 are mapped between 0 and 0.3 and the values above 0.4 get mapped between 0.3 and 1

So if we make a diagram, where the x axis is the value and the y is the outcome, then we get this:

This is fine when you have only 1 flat area, but if I'm trying to recreate something like a farmland in Peru, I have to create a lot of these:

So how can I create an efficient function, which given a value and an array containing the from and to values of the flattened areas transforms the value in the new system.

For instance, using the same example, a value of 0.25 would return 0.3 and a value of 0.5 would return 0.41666....


texts:
Does anyone have any good resources for creating special effects, aimed at programmers.
I'm not specifically interested in particle effects, but broader things like:

Fullscreen effects, blur, depth of field, damage
Explosions, shockwaves
Weapons, lasers, projectile
Environment - light "glows" and beams, water, bubbles, dust etc

I'm interested in these things from a technical perspective rather than an artistic one.

EDIT:
To clarify, I'm not interested in the low level details like "a method for doing depth peeling on SPUs" or "fast particle rendering with vertex textures", I'm interested in how people have combined various techniques into a recipe to show a special effect for the game.

For example - when rendering a "space" explosion:

Draw opaque bright sphere at center.
Draw alpha'd shockwave around a random axis.
Expand sphere and decrease alpha.
Expand shockwave and rotate UVs.
Spawn particles showering randomly from center.
Wobble camera when shockwave reaches viewer position.


texts: How to call game Update from another form

texts:
I have three projects in one solution:

a form with some tool (see it as a level-editor), in which there is PictureBox where I want to redirect drawing of the game.
My game, with some methods and its Update/Draw methods:
A launcher (where I can start the game or start the level-editor)

 protected override void Update(GameTime gameTime) {...}
 protected override void Draw(GameTime gameTime) {...}

This is the launcher's "Open game in editor mode" button code:

private void cmdEditorMode_Click(object sender, EventArgs e)
{
    using (Game1 game_instance = new Game1(true))
    {
        using (MapEditor form = new MapEditor())
        {
            form.Show();
            form.game_wrapper = new GameWrapperForLevelEditor(
                game_instance,
                form.pctSurface.Handle,
                form,
                form.pctSurface);
            game_instance.Run();
        }
    }
}

Note that:

true in Game1 constructor is just a bool used to tell the game to open it in editor mode.
GameWrapperForLevelEditor is another class used to make the form of the level editor and the Game itself in relation.

In particular (to draw inside the pictureBox drawSurface):

 public GameWrapperForLevelEditor(
            Game1 game,
            IntPtr drawSurface,
            System.Windows.Forms.Form parentForm,
            System.Windows.Forms.PictureBox surfacePictureBox)
        {
            graphics = new GraphicsDeviceManager(this);
            //...
            //...other things
            //...
            graphics.PreparingDeviceSettings +=
                new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
        }

and:

 void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
 {
    e.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = drawSurface;
 }

This is the launcher's Main code:

using System;
namespace Launcher
{
#if WINDOWS || XBOX
    static class MAIN
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            using (Launcher_form form = new Launcher_form())
            {
                form.Show();
                //Creo un'istanza del picture_box_render all'interno del form
                form.picture_box_render = new launcher_picture_render(form.pctLauncher.Handle);
                form.picture_box_render.Run();
            }
        }
    }
#endif
}

Note that:

I use here another game (picture_box_render) because in my launcher's form I put a picture box where I want to run an animation that is rendered as another game loop.

Finally the draw part:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);

    spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
    spriteBatch.Draw(game.LastRender, Vector2.Zero, Color.White);
    spriteBatch.End();

    base.Draw(gameTime);
}

My problems are:

game_instance.Run(); (up) gives me this error (translated from italian, so sorry):

  Starting a second message loop on a single thread is not valid operation Use
  Form.ShowDialog.

game.LastRender is Always empty because the game never run. game.LastRender is just a RenderTarget2D where Game1 draw method draws the game.

As a solution, I thought that I may don't game_instance.Run();, but just use game.Update(...) and game.Draw(...) inside my wrapper class. The problem is that these two methods are protected, and if I try to set them public it says me that I can't.

What am I doing wrong?


texts: How to deform 2D tileable texture in XNA/MonoGame

texts:
I'm looking for a way to deform tillable texture in a 2D game I'm building using MonoGame but I'm not sure how this effect is called and searching the internet for "deforming textures" gives me mostly articles about 3D.

I want to texture procedurally generated terrain which can contain lots of little hills. Like on the following picture:

I've deformed this image using Photoshop's free transform tool and I would like to know how can I do this in code.
And also, I would like not to have this "obviously deformed" look with blurred areas where deformation occurred.


texts: Does it make sense to export and use skeletal animation as sprites?

texts:
As tools like Dragonbones, Spine lets you export animations as both sprite atlas and skeleton data (JSON/binary), I'm not sure which format to use when importing to Unity.

I have few concerns:

Will there be any differences between the quality of the animations, when imported as atlas vs skeleton data?
Any other pros and cons, using one over the other?

If I use a sprite atlas, I don't have to depend on a third party runtime though. It is for mobile, so performance is also a concern.


texts: Correct Rotation and Translation with a 4x4 matrix

texts:
I am using a 4x4 matrix to transform verts in a shader. I multiply an identity matrix by a rotation matrix by a translation matrix. I am trying to first rotate the verts and then translate them, however in my result, it appears that the verts are being transformed and then rotated.

My matrix looks something like this:

m00 m01 m02 tx
m10 m11 m12 ty
m20 m21 m22 tz
--- --- --- 1

I am not using OpenGL's fixed function pipeline, I am multiplying matrices on the client side, and uploading the matrix to a GLSL shader.

If it helps, I am using my own matrix multiplication code, but I have recreated this problem using matrices on my graphing calculator, so I don't believe my matrix code has errors..

I'll include a visual aid if needed.


texts: Mobile game: Optimization only working on some devices / Render big texture causes stuttering after level load

texts:
I'm currently optimizing the rendering of the background of my mobile game. The background consists basically of many colored dots. Since the background is static I'm able ro render the whole background into a 1024x1024 texture (render to texture), so the colored dots don't have to rendered in realtime (especially the blending is gpu intensive).

Unfournately this "optimazation" is only an optimazation for certain devices.

My Notebook:
Without optimazation: 400 FPS
With optimazation:    800 FPS

My gaming pc:
Without optimazation:   1100 FPS
With optimazation:    > 2000 FPS

Consider that mobile devices have a frame cap of 60.

Samsung Galaxy Nexus:
Without optimazation: 40 FPS
With optimazation:    60 FPS

LG G2 mini:
Without optimazation: 60 FPS
With optimazation:    60 FPS, but with stutters after loading a new level, which
                              disappear over time

I don't have the slightest idea why the optimazation isn't working for the LG G2 mini.
So the LG G2 mini is faster at real time rendering many small colored dots but slower at rendering a single texture? It's also weird that the stutters only occur after loading a new level but vanish after a little time?

Game is written in C++ using cocos2d-x, but I don't think its a cocos2d-x related issue.


texts: I have seen various implementations of mesh loaders in a few open source game engines. But all of them behave meshes differently. Is there a general definition for a mesh that explains what meshes have, what a submesh is, skeletons etc. I still can not understand the difference between a 3d model and a 3d mesh.


texts: Unity - How to save variables for Android Game?

texts:
This is my current code, it only work into unity, when i test it in an Android Device it don't save the variable

public class Click : MonoBehaviour{

public UnityEngine.UI.Text proiettiliTotali;
public UnityEngine.UI.Text bpc;
public float proiettili = 0.00f;

void OnEnable(){
        proiettili = PlayerPrefs.GetFloat("Player Score");
}

// Update is called once per frame
void Update () {
    proiettiliTotali.text = ConvertiroreProiettili.Instance.GetCurrencyInString(proiettili, false, false);
    bpc.text = ConvertiroreProiettili.Instance.GetCurrencyInString (proiettiliOgniClick, false, true);
}

public void Clicked () {
    proiettili += proiettiliOgniClick;
}

void OnDisable(){

    PlayerPrefs.SetFloat("Player Score", proiettili);
    PlayerPrefs.Save ();
    Debug.Log (proiettili);
}


texts: Frame-rate independant movement with acceleration

texts:
First of all, this is different to this question, because that question doesn't update entities the same way I am.

My update loop goes something like this (for the player):

Apply acceleration based on arrow keys input
Apply some downwards acceleration for gravity
Multiply the acceleration by something like 0.999
Add the acceleration to the velocity
Multiply the velocity by about 0.6
Add the velocity to the player's position
Render the player
Repeat

So, this is a fairly nice smooth movement, and makes it easy to implement jumping by applying a sharp upwards acceleration in one frame.

The only problem is that it seems to make it very difficult to make the movement speed frame-rate independent. I've tried many different ways, like multiplying the movement acceleration by the delta time when it's applied, multiplying the acceleration by the delta time just before being added to the acceleration, multiplying the velocity by the delta time, etc., but none of these worked. They pretty much all had the same effect of varying movement speed and jump height dependant on the frame-rate.

My question is: with this, or a similarly working, movement system, how can I use delta-time or otherwise to ensure the movement speed, gravity, and similar, is not dependant on the frame-rate.


texts:
I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic.

The whole Scenario is explained below:
I have 3 balls in total. I want to balls to remain in their places and the third ball to be able to move. When the third ball hits the other two balls then they should move according to the speed and direction from which they were hit.
My gravity of the world is 0 because I only want z-axis gravity.

I would also like some one to point me towards some good tutorials regarding Box 2D basics which is language independent.

I hope I have explained my scenario well.

Thanks for the help in advance.


texts: What techniques make next gen look so realistic

texts:
I have watch several gameplays from upcoming titles for ps4 and xbox one and I must admit that they are breath taking.

Of course with new hardware, models will have more polygons and higher texture resolution but that is obvious tip of iceberg.
So my question  is :Are there any complete new techniques, algorithms, shaders broadly used in next gen, already known on paper but not used in current gen because of limitation of hardware or this is all same but more complex,less generic or made for in-house use(unknown for public) to provide better visual result for specified engine.

From my observation:

Realistic particles,fluids (papers?)
Geometry shaders (examples?)

What I expected to see but was not shown:

Fracturing
Generic destruction of buildings and cars!

Is this still to compute heavy for large scale scenes?


texts: Creating a static 2D background at runtime

texts:
I'm using unity for a 2D game.

We have a lot of props for grass, plants, flowers, etc that are static and always in the background. I'd like to optimize the background and reduce the drawcalls as much as possible by making a big image with the final result of the background.

The idea would be to draw on a texture all the elements in the background, and then use this texture as the background. This way a single element has to be drawn.

How can I create these background texture at runtime, so it is generated as soon as the scene is loaded?


texts: Bullet softbody nodes messed up positions

texts:
I recently switched from Havok physics to Bullet because I wanted to have soft body collisions, but I don't have any budget to license the (superior?) Havok solution, I couldn't even try those functions out there so it is completely new to me.
I want to create a soft body from an arbitrary mesh and for that I use the soft body helper:

btVector3* btVerts = new btVector3[vertices.size()];
for(int i=0;i<vertices.size();++i)
    btVerts[i] = (btVector3(vertices[i].pos.x,vertices[i].pos.y,vertices[i].pos.z));
const int iCount = indices.size();
const int tCount = iCount/3;
int* btInd = new int[iCount];
for(int i=0;i<iCount;++i){
    btInd[i] = (int)indices[i];
}

btSoftBody* softBody = btSoftBodyHelpers::CreateFromTriMesh(
        ((btSoftRigidDynamicsWorld*)dynamicsWorld)->getWorldInfo()
        ,(btScalar*)btVerts
        ,&btInd[0],tCount
        ,false
    );

Where vertices and indices are vector references coming from my graphics engine. I fill out the mesh with that information and seemingly I can create it without problem. After I step the physics world I connect my BULLET softbody nodes to my vertices in the graphics engine, then updating the vertex buffer.
I get the information from the softbody nodes by their tNodeArray m_nodes this way:

btSoftBody::tNodeArray&   nodes(softBody->m_nodes);

    for(int j=0;j<nodes.size();++j)
    {
        verticesIn[j].pos=XMFLOAT3(nodes[j].m_x.getX(),nodes[j].m_x.getY(),nodes[j].m_x.getZ());
        verticesIn[j].nor=XMFLOAT3(nodes[j].m_n.getX(),nodes[j].m_n.getY(),nodes[j].m_n.getZ());
    }

The problem: However I do not get correct vertex positions and neither correct normals. I am using a simple quad mesh with 4 vertices (the positions):
{ (-1,0,-1), (1,0,-1), (1,0,1), (-1,0,1) }
But if I get values from the softbody's nodes after creation, but before stepping any physics I don't get back my original values from the nodes (the positions):
{ (-1,0,-1), (0,1,0), (-1,0,1), (0,1,0) }
I even noticed the node vertices kind of resemble the originals, just "overlapped" somehow or not sure how can I describe if it is even the case, but it is like the second vector has an extra zero at the beginning and the whole mesh got screwed up.
Could it be something is not right with my loading? Or do I miss something in the concept of soft body physics?
I have studied the bullet soft body sample which is quite informative and they sure load their meshes like I do (the bunny mesh for instance), at least it seems like it. I don't have any idea and got stuck here for a day now. Without connecting to the softbody, my mesh remains correct.


texts: How to layer the Worley noise like this?

texts:
Recently I'm trying to implement Siggraph15_Schneider_Real-Time_Volumetric_Cloudscapes_of_Horizon_Zero_Dawn, you can also find this in GPU Pro 7, (part II Lighting, chapter 4, Real-Time Volumetric Cloudscape).

I can make the first Worley noise above and increase the frequency, I can get another Worley noise, but how to blend the two noise to get the middle noise and finally, the third noise"?

The last image is two single frequence worley noise and the result I blend them.You can try your method with them.

My formula is this:

tmp = (worley1 + smoothstep(0, 1, worley1)*worley2*0.5) / (1 + smoothstep(0, 1, worley1)*0.5);
tmp = ReMap(0, 1, 0, 0.7, tmp);

ReMap is:

double ReMap(double oldMin, double oldMax, double newMin, double newMax, double src);

Note that worley1 and worley2 is worley noise range from 0 to 1.The result is close in the first glance,but it's not the same apparently. I think the formula is TOO tricky and maybe I got something wrong.


texts: How to rotate enemies on 2D radar and clip them to circle shape?

texts:
I've been working on implementing a 2D radar for a 3D game lately, it's working fine in a very basic version. This is what is looks like:

It works by transforming the 3D coordinates of the enemies nearby to the local player space and then drawing those coordinates with the center-offset of the radar circle.

Transforming the enemy positions (and adding them to a vector):

if (LocalPlayer)
{
    Vec3    diff;
    double  distance;
    position.clear();

    for (auto i = commonInfected.begin(); i != commonInfected.end(); ++i)
    {
        diff = (*i)->GetPosition() - Global::camera->GetPosition(true);
        distance = diff.xz().Length();

        if (diff < 100)
        {
            position.push_back(diff);
        }
    }
}

Drawing the enemies:

    for (int i = 0; i < position.size(); ++i)
    {
        pos.x = position[i].x;
        pos.y = position[i].z;

        pos += {80, 80}; // center of the circle

        context->DrawText("x", pos.x, pos.y);
    }

However, the problem I have is that the plotted enemies do not rotate with the player and that plotted enemies can "go out" of the circle shape of the radar. How do I approach this kind of problem?

I have seen and carefully read through this question but couldn't understand it.
Plotting entities on a radar


texts: Extrapolation - synchronize destination point on a second device while moving

texts:
First of all, I read all of the Valve and Gaffer articles but I still have no clue, how to achieve my goal.

I am creating a UDP multiplayer game with a lot of physics (knockbacks, attacks). Packets delivery and sequence numbers are done - there is no loss, but the problem is with synchronizing ME (when I'm moving) on the second client (my opponent's).

As I read, there are two options:

1) delay the client by 100 ms and draw everything from the past - which is unacceptable, cause it really has to be a real time game. I know that for Valve this is enough, cause they have only shooting and they go back in time for just couple of variables, check some timesteps and they're done, but here, I have to check everything, if the player was in the air, if he was punched etc.

There is also a second option which is in a REAL TIME:

2) Real time, but with dead reckoning/extrapolation:

we get last two received positions
we make a normalized vector
no matter what - we just move the player by that vector in an update method

And here is the problem. I decided to pick option two - with extrapolation, cause it's the only solution, but I have no idea, how to stop the character in a place on the opponents client, where it was stopped on it's own client.

An example:
Speed is constant - 5 pixels per move.
Perfect world - we send a packet with position every frame.
So we move by 5 steps on X axis:

0,0 -> 5,0 -> 10,0 -> 15,0 -> 20,0 -> 25,0 (We stoppped on the client)

So we've sent 5 positions to the server and he sent it to the opponent.

We receive these packets on a second client (opponent) and we have to move the character with received packets.

And here comes the question, HOW?
Of course, vectors, I know these, but I have no idea how to synchronize this, that at the end the character on the opponent's phone is still on the same position (25,0).

An example of a problem:
We move 4 right, 2 left on the client:
0 > 5 > 10 > 15 > 20 > 15 > 10.

Opponents gets: 0, 5, 10, 15, 20 (he's moving by 1,0 normalized vector) but this is extrapolation, he moves also to 25, 30 (WHICH IS OKAY, it doesn't matter if he runned too far, it's only 10 pixels), then he get's the newest packet, he changes the vector to (-1,0) to move left, he moves two times and here comes the total misunderstanding, he will move only two times and he will land on (20,0), not on (10,0), cause this is the end of the packets.

A quicker explanation - he wasted his moves by moving 20 -> 25 -> 30, he should have use them to move these two points left - from x = 20 to x = 10;

I really need help with this, I went through hell by implementing reliable UDP and this desynchronization is killing me, really.

If someone had some experience with these things in Java, or anything, I would be grateful.


texts: Do I need the 'w' component in my Vector class?

texts:
Assume you're writing matrix code that handles rotation, translation etc for 3d space.

Now the transformation matrices have to be 4x4 to fit the translation component in.

However, you don't actually need to store a w component in the vector do you?

Even in perspective division, you can simply compute and store w outside of the vector, and perspective divide before returning from the method.

For example:

// post multiply vec2=matrix*vector
Vector operator*( const Matrix & a, const Vector& v )
{
  Vector r ;
  // do matrix mult
  r.x = a._11*v.x + a._12*v.y ...

  real w = a._41*v.x + a._42*v.y ...

  // perspective divide
  r /= w ;

  return r ;
}

Is there a point in storing w in the Vector class?


texts: How can Apple know how an iOS game is made?

texts:
As you all know, Apple recently change the terms for app developers using 3rd dev tools.

I'm wondering how could Apple know whether an app is made with a specific technology like Flash or Unity or GameSalad or any other engines out there?


texts: Cocos2d Composition using CCSpriteBatchNode

texts:
I'm making a game in objective-c using cocos2d. I have the following:

@interface Player : CCNode
{
    CCSprite *mySprite;
    CCSpriteBatchNode *sceneSpriteBatchNode;
    //...
}
@property (nonatomic,retain) CCSprite *mySprite;
- (id)initWithSpriteBatch:(CCSpriteBatchNode *)_spn;
-(void)updateStateWithDeltaTime:(ccTime)deltaTime andListOfGameObjects:(CCArray*)listOfGameObjects;
@end

@implementation Player
- (id)initWithSpriteBatch:(CCSpriteBatchNode *)_spn
{
    self = [super init];
    if (self) {
        sceneSpriteBatchNode = _spn;
        mySprite = [CCSprite spriteWithSpriteFrameName:@"player_image.png"];
        [_spn addChild:mySprite];
    }
    return self;
}
//....
@end

Now in the layer I would do:

//...
Player *player = [[Player alloc] initWithSpriteBatch:sceneSpriteBatchNode];
[player release];

-(void) update:(ccTime)deltaTime
{
    CCArray *listOfGameObjects = [sceneSpriteBatchNode children];
    for (CCNode *tempChar in listOfGameObjects) {
        [tempChar updateStateWithDeltaTime:deltaTime andListOfGameObjects:listOfGameObjects];
    }
}

However, you can only add CCSprite to the spritebatchnode, that way I can't update my custom classes. What do I have to do?


texts:
I have a problem here.

I animated my main character and is working. It walks run and jump however it goes across walls and ground.

As in every single video I watch in unity tutorials I put a navigation static in every single wall and game object. However the main character still go across them as thin air

The main character has a rigid body and collider as does the  the wall and other game objects

I really don't understand
I don't really understand what i did wrong or what I miss? Script ? other things I am not aware?The Nav Mesh Agent? ]1

I really hope someone can help me

Thanks in advance

CL


texts:
I'm using a 3d game engine, that uses a 4x4 matrix to modify the camera projection.

The matrix is in the regular 4x4 format:

 r r r  x
 r r r  y
 r r r  z
 - - -  zoom

The description for the matrix class says:

  A transformation matrix. Matrices are pre-multiplication, as in: x' =
  M*x.

What does this mean?


texts: How to achieve smooth movement with a fixed timestep

texts:
Previously in the update method of my game I was using a variable time step which provided very smooth movement of a player sprite except when the frame rate would drop, even slightly. At that point I would end up with the sprite making a noticeable lunge forward. I tried averaging the delta to make it less noticeable but wasn't satisfied.

So I've been trying to implement a fixed time step using the code provided in the article http://gafferongames.com/game-physics/fix-your-timestep/ as an example.

double t = 0.0;
const double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;
     currentTime = newTime;

     accumulator += frameTime;

     // ***** Is this where I should add acceleration to the current state velocity? *****
     // current.v += Player::MoveAcceleration * frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );
}

In this example where would I add to the velocity? As I noted in the code comment, I am currently adding it prior to the integration loop, but the sprite movement is now consistently lunging forward each frame and is not smooth at all. Even when lowering the acceleration it is still there, and is not a solution anyway as I want the player to be able to walk or run.

I hope this makes sense. I have read so many articles over the last couple weeks and tried many combinations but nothing is working smoothly. I figure someone here must have a solid routine to achieve a fixed time step in a game with smooth sprite movement/animation.

Thanks


texts:
I am just before implementing screen space ambient occlusion in my game, but first I wanted to try enabling it from NVidia control panel only to find out that it is greyed out so that I can not enable it. With this I could enable SSAO for some other games, but not every one. I know this technique requires the depth buffer and (optionally) a normal map texture to sample information from which I already have access to given I have a deferred renderer working.
After that I actually thought to roll back to a previous version of my game which still uses forward rendering so the depth buffer is actually bound to the backbuffer which I render to from the get-go so that maybe the NVidia control panel would somehow make use of it. It was not working with forward rendering either. (I also tried FXAA in the control panel and that works - but it doesn't need any depth or normal texture)
So my question is that how can I enable this function so that it would work by enabling it in the NVidia control panel?


texts: Does the Windows Raw Input API provide lower latency input than WM_MOUSEMOVE?

texts: I've read up a lot about the Raw Input API and so far could only tell that it bypasses os filters like mouse acceleration. However what i am looking for is a way to reduce input latency on mouse movement, and i cannot find any clear comments on whether switching to Raw Input will lower the input latency over the traditional windows messages.


texts: Power Distribution amongst connected nodes

texts:
In my game the map is represented by connected nodes, each node has a number of connected nodes. The nodes represent a system in which players can build structures and move units about. If you're familiar with Sins of a Solar Empire the game map is very similar.

I want each node to be able to produce power and share it with all connected nodes.
For example if A, B, C & D are all connected and produce 100 power units, then each system
should have 400 power units available. If node B builds a structure that consumes 100 power units then A, B, C & D should then have 300 power units available.

I've been working on this system all day and haven't been able to get it working quite the way I want.

My current implementation is to first recurse through each nodes's connected node adding up the power, I keep a list of closed nodes so it doesn't loop, it's quite similar to A* actually.

Pseudo code:
All nodes start with the properties

node.power = 0
node.basePower = 100 // could be different for each node.
node.initialPower = node.basePower

-

function propagatePower( node, initialPower, closedNodes )
  node.power += initialPower
  add( closedNodes, node )
  connectedNodes = connected_nodes_except_from( closedNodes )
  foreach node in connectedNodes do
     propagatePower( node, initialPower, closedNodes )
  end
end

After this I iterate through all power consumers.

foreach consumer in consumers do
   node = consumer.parentNode
   if node.power >= consumer.powerConsumption then
     consumer.powerConsumed += consumer.powerConsumption
     node.producedPower -= consumer.powerConsumption
   end
end

Then I adjust the initial power for the next propagation cycle.

foreach node in nodes do
   node.initialPower = node.basePower - node.producedPower
   node.displayPower = node.power // for rendering the power.
   node.power = 0
end

This seemed to work at first but then I came into a problem.

Say two nodes A & B produce 100Pu each, it's shared so both A & B have 200Pu.
I then make two structures that consume 80Pu each on A (160Pu).
Then the nodes power is adjusted to basePower - producedPower (100-160 = -60).
Nodes are propagated, both nodes now have 40Pu (A: -60 + B: 100 = 40).
Which is correct because they started with 200Pu - 160Pu = 40Pu.
However now node.power >= consumer.powerConsumption is false.
Whats worse is it's false for any structure that uses more that 40Pu, so the whole system goes down.

I could deduct from consumer.powerConsumption but what do I do if power is reduced elsewhere? I don't have the correct data to perform the necessary checks.

It's late so I'm probably not thinking straight but I thought to ask on here to see if anyone has any other implementations, better or worse I'd be interested to know.


texts: Disable and re-enable image tracking ARKit

texts:
Is there a way to disable and re-enable tracking for images in ARKit? From the older versions, this was the solution. But the newer versions have removed the UnityARSessionNativeInterface script.
void Start ()
{
    m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
}

void AddImageAnchor(ARImageAnchor arImageAnchor)
{
    //at the bottom of this function
    StartCoroutine(RemoveAnchorCoroutine(arImageAnchor));
}

IEnumerator RemoveAnchorCoroutine(ARImageAnchor anchor)
{
    yield return new WaitForSeconds(3.0f);
    //doesn't have to be in a coroutine, but for my uses it is
    m_session.RemoveUserAnchor(anchor.identifier);
}


texts:
This question has two parts:

1. How to get meaningful information out of Xcode crash logs? The game runs fine on the editor but when running on an iOS device it crashes and then gives information like this:

How can I dig out which script actually causes this?

2. Which Xcode debugging tools are available for Unity games? There are plenty of them mentioned here. Especially the frame capture and Instruments profiling seem very handy.


texts: How to build a math module and simulate a system?

texts:
For example, in the classical game SimCity:

an economic model to simulate the supply and demand of the city, then calculate how many people live in each building, how many people work there.
a traffic model to simulate the commute time of the citizens,
in another game, there'd be a whole stock market, where the player and sim-citizens can buy and sell.

Obviously, we cannot simulate every single citizen, every single car, every single trader in the market, we need some math modules and formulas.

I'm making a fake SimCity and almost finished the graphics parts. Now I'd like to know how to do the math parts, or how to build such math modules.


texts: Is it possible to crop a render texture in unity?

texts:
Basically what I want to do is, take the source render texture from OnRenderImage and crop it (continuously). I've already achieved this by using ReadPixels to a texture however this has a negative impact in my FPS. Is there any other way that is less expensive?

Here's an example of what I want to do:


texts: Whose name should I put next to my copyright notice?

texts:
I've seen other developers put their own names next to their copyright notice while others choose to put their studio name instead.

I read that having a studio name could potentially protect me legally in the future. if that's the case, why do some indie developers opt to instead put in their real names?

But I also read that if you're just starting out, it's better to just use your name instead.

Also if I put in a studio name instead, is the game still copyrighted to me or the random studio name I give it?

Edit: Upon doing some more reading online, it seems like it'll be more beneficial to use a studio name because it'll easier to perform SEO with it. Am I right about this? This is really confusing me.


texts: Designing a four-directional movement control

texts:
I'm developing an RPG for iOS. Currently, I plan my controls to look like this:

So the user can interact with objects, people, etc. by tapping on the right side of the screen, and moves by swiping in the direction they want to go in on the left side of the screen. Right now, I'm having a problem with the movement controls. What I want is for there not to be a fixed d-pad; I want the user to be able to tap anywhere on the left side of the screen and swipe in the direction they want (within a range, demonstrated in the below image), and it seems easy enough to implement this.

However, I'm having a bit of a math problem. Since I'm developing for iOS, how I planned to implement this was to subclass UIView and have two properties, startTouch and endTouch that represented where the user began his/her swipe and where the user lifted his/her finger. Then, I could do a bit of math and discern which direction the swipe was in. But I'm having a bit of trouble doing the math, and that's what my question's about: given two points, how can I figure out if the swipe was going up, down, left, or right? Keep in mind that the user could tap anywhere on the screen and that tap is the center of the imaginary d-pad, like so:


texts: Unity Tilemaps not Rendering as I move camera

texts:
As I move the main camera in my Unity game towards the left or right, the camera just stops rendering any of the tilemaps in the scene.

Here, the camera is at x = 25.7, and the preview isn't showing anything (Neither is the game view), but as I move the camera inwards towards x = 24.7, everything renders normally...

I can clearly see the tilemap objects in the scene view though...


texts:
Im using pretty basic code here

charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);

Im using rigidbody 2d and I'm creating a platformer. When i press the button the character transforms very little in y axis.


texts: How can a desktop Java game be distributed without a Java runtime dependency?

texts:
Is it possible to turn a Java application into a standalone package that runs "out of the box"? The end user should not be required to install any Java JRE, nor should the installer contain a JRE and install it for the user.

The final distribution should contain a native executable (hopefully one for each of Windows, Mac and Linux) along with the regular data files and any extra JARs if needed. I'm not looking for a "one file" solution specifically -- I'd actually like data files to be unobfuscated.

How can this be done?


texts: Unity Particle System collision detection problem

texts:
I'm using Unity 3.5.5f3 wich has the Shuriken particle system.

I've made a blood particle system based on Unity's demos. (Exploding paint [Blood])
The blood is flowing and when it collides with a Plane Transform wich I've created a small pool of blood spawns as a Collision Sub Emitter.

My main problem is that when I want to add another object to collide it just doesn't want to work. When I create a cube, and set it as a collision plane the collision will only occur at the half of the cube.

I want this to happen: When it reaches the cube's surface the sub emmiter activates, and when the surface is horizontal it appears horizontally, and if it's vertical then vertically. Now it just appears horizontally everytime like in the picture.

How could I solve it?


texts: Are my programming methods for java games sufficient

texts:
so I'm making a 2d Java game with the slick2d and MarteEngine libraries. This is the biggest project since I made checkers for my Java class. I am still pretty new to programming concepts and using optimal ways to get stuff done.

The basic structure of my game is you are a player/hero in a zombie apocalypse and you can gather survivors to help you. There are a many areas that I'm concerned about in my programming. I'm not sure if my methods are a good choice for what I want. This game also does not currently have a grid/tile system.

I've looked at some open source java games and they don't really answer my questions to my methods. So I'm going to make a list here of what I'm uncertain about and I hope you guys can confirm/deny if my methods are appropriate. Sorry if this list gets too long, I'm thinking of the questions as I type.

Targeting/Attacking - Survivors will automatically attack zombies once they get within the gun's target range. To do this, I have every survivor get the distance (using distance formula) to every zombie and find the closest one to attack. I check for this constantly so if a faster zombie gets closer, the survivor will change targets. For zombies, they acquire a target and stick to it (for now). The zombies constantly check if they are within the attack range (around 50 pixels) using the distance formula. If they are within range, stop and attack, otherwise, move towards the target.
2D Camera - So a camera in a 2D environment moves the world around instead of you. My current method is have my zombies/survivors/any entities on the map stored in array lists. First the background is adjusted, then all the lists are cycled through and every entity's x and y values are modified. This seems to work alright but some stuff you can really notice sliding around on the background. Not really sure how to avoid this.
User Interface - I really have no clue how to work with UI. What I've been doing so far is simply using a background and then generating button objects and manually lining them up. Then, I check if the mouse is over any of the button's areas and if there is a click while moused over the button. I have three different backgrounds and buttons that I switch out with booleans. I'm going to recode that area though, using objects with the background and buttons. Is this the correct way to do UI?
Path Finding - I have no path finding system yet. Do I have to stick to a grid system? I really rather my entities move freely along the terrain and not in a weird square to square motion.
Selecting - I have it so you can select survivors, upgrade them, and other random stuff. My current method for selecting is constantly check where the mouse X and Y is. I get the distance from the mouse to every survivor and check if it is within 30 pixels. Then, I check if there is a click, if so, select the survivor and unselect all others. I'm still trying to figure out how to unselect all survivors if I click on open space. Is there a better way to go about doing this?
Picking stuff up - Same way as said before. I check the distance from the player to every item that can be picked up. If the item is within 30 pixels of the player, it picks it up. It seems to work fine for the moment I suppose. Maybe there really is no other way to do this.
Animations - I understand the how to animate with sprites, but I just want to make sure. So if I have 7 different guns to be shot, do I need to manually make functions that have precise timing on each sprite. Say if I have a shotgun, it needs a recoil, pump forward, brief pause, pump back, and ready again. For a pistol I need just the recoil really. So I'd have to make unique functions for each of these animations?

Sorry to type this long list of questions. I try to gather information on this stuff as much as possible and I haven't been able to find many examples on this stuff. I greatly appreciated any answers, even just a yes or no answer. Thanks in advance!


texts:
So I downloaded Asset Store Tools in the Unity Asset Store. When I upload my asset to my package, I get this popup:

  Wrong project path The path selected must be inside the currently active project. Note that the AssetStoreTools folder is removed
  automatically before the package enters the asset store.

My Unity is version 5.4.0b25. I've tried other assets and reinstalled Unity, I still get the same popup.

Screenshot:


texts: How far should I go in securing Groovy mod scripts?

texts:
I am developing a game in java and plan to embed the Groovy script engine to allow for more robust modding options. This comes at a price, of course. Groovy can access anything java can by default, making it something of a security risk. At the moment, this doesn't worry me all too much, as mods for many other single player games such as minecraft already provide this level of access.

However, while the game does not currently have multiplayer support, I would very much like to change that at some point after the initial release. In this case, I would like to be able to allow servers to supply required mod files directly to the client. Is it safe to allow this sort interaction in any case?

My current plan of implementation for this would be to have the server supply mod files to clients, then have the clients pass the name of the mod to a public server I'd host, receiving back from me the expected hash value of that mod to compare against a locally computed hash of the files received from the client. They'd also be given the public rating and description of the mod, and be prompted from there if they wished to keep the mod or discard it.

Obviously this would still require me hosting a mod validation server, so that mods not on the server would be rejected by default. And I'd likely have to provide the ability to download mods directly from this server for users looking to get these mods in the first place, but the purpose of this is to allow players to easily connect to servers without planning out ahead of time what mods they'd need to download, while also decreasing some of the bandwidth overhead I'd have to deal with by having servers host the files and myself simply serving up short blocks of text and hashes.

In summary: Is this complete overkill? Can I even trust servers to host safe content? Can I trust servers to host safe content without checking up on the files they send? Is this not enough security? Do I need to sandbox groovy, or would I be wasting my time?


texts: What does rebuilding the .vcxproj file do?

texts: I'm having the same problem this user had.  The solution is confusing me, because all I want to do is comment out the code I added that caused the compiler crash, get Unreal to accept it and stop crashing, but he sounds like he is rebuilding the whole engine, and I just have one crashing project.  I tried commenting out the code and saving the visual studio project, but it didn't change anything.  What is his solution doing?


texts: How can I capture every frame in DirectX 9 using a shader

texts:
This is actually a follow up to this question
How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile

The proponent of the best solution suggested that I should look at a shader program to capture the screen. How could I do that. I have no clue on how can I use a shader program to do that.


texts: Workaround the flip queue (AKA pre-rendered frames) in OpenGL?

texts:
It appears that some drivers implement a "flip queue" such that, even with vsync enabled, the first few calls to swap buffers return immediately (queuing those frames for later use). It is only after this queue is filled that buffer swaps will block to synchronize with vblank.

This behavior is detrimental to my application. It creates latency. Does anyone know of a way to disable it or a workaround for dealing with it?

The OpenGL Wiki on Swap Interval suggests a call to glFinish after the swap but I've had no such luck with that trick.