texts: How to make texture size correctly in THREE.js?

texts:
I'm new to THREE.js and I have a frustrating problem. I can't get my grass texture to size "normally" on the terrain.

I get it, the terrain is steep, but that doesn't mean the grass should be stretched as well!

I don't want the textures to scale, resize, stretch, or distort. I want the textures to render the same size as the original image. The image is 128x128, so why can't the texture be the exact same?

THREE.js doesn't allow me to make the texture repeat as much as it needs to fill the plane. It only lets me set a fixed number of "repeats." That's what most likely causes the distortion.

texture.repeat.set(10, 10);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;

How can make the size of the texture not be affected by the size of the polygon it's on? If the image is 128x128, it should still be 128x128 on the terrain.

  EDIT: Is it possible to use pixel coordinates instead of UV?


texts: How do I get FEATURE_LEVEL_9_3 to work with shaders in Direct3D11?

texts:
Currently I'm going through some tutorials and learning DX11 on a DX10 machine (though I just ordered a new DX11 compatible computer) by means of setting the D3D_FEATURE_LEVEL_ setting to 10_0 and switching the vertex and pixel shader versions in D3DX11CompileFromFile to "vs_4_0" and "ps_4_0" respectively. This works fine as I'm not using any DX11-only features yet.

I'd like to make it compatible with DX9.0c, which naively I thought I could do by changing the feature level setting to 9_3 or something and taking the vertex/pixel shader versions down to 3 or 2. However, no matter what I change the vertex/pixel shader versions to, it always fails when I try to call D3DX11CompileFromFile to compile the vertex/pixel shader files when I have D3D_FEATURE_LEVEL_9_3 enabled.

Maybe this is due to the the vertex/pixel shader files themselves being incompatible for the lower vertex/pixel shader versions, but I'm not expert enough to say.

My shader files are listed below:

Vertex shader:

cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};

struct VertexInputType
{
float4 position : POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};

struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};

PixelInputType LightVertexShader(VertexInputType input)
{
PixelInputType output;

// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;

// Calculate the position of the vertex against the world, view, and projection matrices.
output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix);

// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
// Calculate the normal vector against the world matrix only.
output.normal = mul(input.normal, (float3x3)worldMatrix);

// Normalize the normal vector.
output.normal = normalize(output.normal);

return output;
}

Pixel Shader:

Texture2D shaderTexture;
SamplerState SampleType;

cbuffer LightBuffer
{
float4 ambientColor;
float4 diffuseColor;
float3 lightDirection;
float padding;
};

struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};

float4 LightPixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float3 lightDir;
float lightIntensity;
float4 color;

// Sample the pixel color from the texture using the sampler at this texture coordinate location.
textureColor = shaderTexture.Sample(SampleType, input.tex);

 // Set the default output color to the ambient light value for all pixels.
color = ambientColor;

// Invert the light direction for calculations.
lightDir = -lightDirection;

// Calculate the amount of light on this pixel.
lightIntensity = saturate(dot(input.normal, lightDir));

if(lightIntensity > 0.0f)
{
    // Determine the final diffuse color based on the diffuse color and the amount of light intensity.
    color += (diffuseColor * lightIntensity);
}

// Saturate the final light color.
color = saturate(color);

// Multiply the texture pixel and the final diffuse color to get the final pixel color result.
color = color * textureColor;

return color;
}


texts:
As many of you are, I am working on a game.

I have just added my first attempt at shadow mapping (standard variation) and quite frankly I am very disappointed.

I am literally squeezing as much out of this approach as possible and it simply not usable.

Its too slow and too ugly to look at!

So what do people do?

I have bumped into something called "Perspective shadow mapping" but I have not got any working examples of this yet and I don't really want to spend a long time working on this only to find that its too slow to use and not all that much better.

So what I am asking for is some feedback on your experiences and how you overcome all the problems with shadow maps.

Some details are:
I have a single light (point light)
Standard first person type game
The light moves (all the time, but slowly)
The draw distance is not very far

If I don't use shadows then the game runs at 500 FPS, and with shadows it drops to 90!

Edit:
As I have said, I have put a lot of effort into this so I have already solved:
Getting the tightest possible near/far
Getting the tightest X/Y (without constant change per frame)
I have no peter panning
No acne

But, due to the fact that my light moves all the time I get constantly (shaking) shadow pixels.

And the only way I am able to make the shadows look crisp/and stop shaking is to make the shadow map ridiculously high resolution. And this then drops the frame rate too much.

I understand all the problem, but what I want to know is what do people rely do to solve the problem. People cant really be using this in games as its just no good.

I am also looking into cascaded Shadow Mapping. That looks to be the solution. What are people experience with this?


texts: Manual response when 2 shapes made of rectangular volumes collide

texts:
I have 2 compound objects made of rectangular blocks. One of them (the one that is moving) has a script that listens to OnTrigger callbacks. What I need is to position the moving compound object on the first compound object to make then not collide but stay in contact.

As an example you can thing of two "spheres" made of blocks. Both spheres are on the floor. Then I move one of the spheres (still on the floor) and I detect that it collides the other sphere, so, I need to push the moving sphere up to make it not collide with the first one but stay in contact.

I have a manual algorithm that make tests on the different blocks of the two groups to push it up enough to make them not collide but it is a bit intensive. Do anybody know if unity physic engine can help here? The main problem is that after I receive the collision I can not move the moving sphere up and recheck manually first of all because there's no Check for rectangles and on the other hand if I want to be notified by the physical engine after I move the moving sphere up (to see if it still collides)I need to wait a new frame which is not feasible in my case.

P.S. I'm using unity engine.


texts: Algorithm for clipping convex quadrilaterals

texts:
I'm dealing with hardware that uses quads as its polygonal primitive. Not triangles. A triangle can be expressed by setting 2 of the 4 equal to each other for a degenerate quad.

For the 3D engine, I'm in need of clipping for polygons outside of clip space volume in order to avoid vertex inversion and division by zero errors when performing the perspective divide.

My logic is that I first identify the primitives that intersect with the 6 planes. From there I add edges to cut the primitive. What I don't understand at this point is how to cut/add quads. Do I need to "triangulate", but for quads?


texts: Rotating an image in Slick2D in place in a tiled map?

texts:
I just finished writing a parser for TMX data (Tiled maps), and the way Tiled handles rotated tiles is by using three bit flags for flipping an image horizontally, vertically, and diagonally, to allow for rotation. Unless I'm wrong, flipping an image "diagonally" is just rotating 90 degrees CCW (counter-clockwise) and then flipping horizontally.

So I tried to implement this when I create the sub-image of the tileset for each tile:

public Image getImage(Image tileset, int w, int h) {
    if(tid == 0) return null;

    int nh = tileset.getWidth() / w; // Number of tiles in this tileset horizontally.

    // Offsets to be multiplied by tile width and height to get origin point of tile.
    int ox = ((tid - 1) % nh); // Subtract 1 because the TID numbers are 1-indexed (why use 0 to indicate nothing? why not -1? stupid Tiled...)
    int oy = ((tid - 1) / nh);

    Image sub = tileset.getSubImage((ox * w), (oy * h), w, h);

    // If any of the flip bits are set, flip the image.
    if(fh || fv) sub = sub.getFlippedCopy(fh, fv);
    if(fd) {
        // To flip diagonally, rotate counter-clockwise, then flip it horizontally.
        sub.setRotation(-90);
        sub = sub.getFlippedCopy(true, false);
    }

    return sub;
}

Specifically, the area where I set the rotation of the sub-image is what's causing my problem. Despite setting the rotation, the image is not rotated on the canvas. Doing a little digging into the library (what little information there is), it seems that the Image class' internal rotate methods don't actually do anything to the image, and most rotation is done using the Graphics context's rotate methods, which rotate the entire context and then draw the image.

The only problem with that is that if I rotate my graphics context, which is the map I'm constructing using these tiles, then the coordinates I give to draw the tile are no longer correct because of the rotated context, so my tiles come out all over the place.

What would be my solution here for rotating the images? Is there a transformation I can do to the coordinates once the graphics context is rotated so they draw in the correct position? I don't know anything about linear algebra, so I'm not sure what to do from here.


texts: Wrong UV mapping when using small textures and positions

texts:
I am using a really small texture (64x64) and when I use it as a UV map on my mesh, there are some incomplete lines from the color of the other side of the UV map rendered as well (in this case, white.)

The model was made in Blender, and it is rendered without this error. I set absolute coordinates, so the UV coordinates are multiple of 1.0 (1.0, 2.0, 3.0, 4.0, etc.) I am using Ogre as renderer

This is the UV map:

Image with error:


texts: Ashikhmin-Shirley model implementation: ugly result

texts:
I am trying to implement the Ashikhmin-Shirley model using these formulas:

This is the GLSL 1.2 fragment shader code:

uniform vec4 materialAmbient, materialDiffuse, materialSpecular;
uniform float materialShininess;
uniform vec4 lightAmbient, lightDiffuse, lightSpecular, lightPosition;

varying vec3 P,N;

float pi= 3.1415926535;

vec4 Fd(float NdotV, float NdotL) {
    vec4 fd= (28.0 * materialDiffuse * lightDiffuse) / (23.0 * pi) * (1.0 - materialSpecular * lightSpecular);
    fd*= 1.0 - pow(1.0-NdotV/2.0,5.0);
    fd*= 1.0 - pow(1.0-NdotL/2.0, 5.0);
    return fd;
}

vec4 Fr(float u, vec4 specular) {
    return specular + (1.0-specular) * pow(1.0 - u, 5.0);
}

// f= phi
vec4 Fs(float VdotH, float NdotH, float NdotL, float NdotV, float et, float eb, float f) {
    vec4 fs= Fr(VdotH, materialSpecular * lightSpecular);
    fs*= sqrt((et+1.0) * (eb+1.0)) / (8.0 * pi);
    fs*=  pow(NdotH, et*pow(cos(f),2.0) + eb*pow(sin(f),2.0)) / (VdotH * max(NdotL, NdotV));
    return fs;
}

void main(void) {
    vec3 L= normalize(vec3(lightPosition) - P);
    vec3 V= cameraPosition;
    vec3 H= normalize(L+V);
    float NdotL= max(dot(N,L),0.0);
    float NdotV= max(dot(N,V),0.0);
    float NdotH= max(dot(N,H),0.0);
    float VdotH= max(dot(V,H),0.0);
    gl_FragColor= Fd(NdotV, NdotL) + Fs(VdotH, NdotH, NdotL, NdotV, 128.0,128.0,1.0);
}

I already checked and it seems like all the uniforms and varying are passed in the right way, I pass P and N from the vertex shader. The variables are:

Light direction: L;
Surface normal: N;
Camera direction: V;
Half vector: H;
Fragment position: P.

The uniforms I pass are:

light{Specular | Diffuse | Ambient} : 0xffffff (converted to a rgba vector of course);
materialAmbient: 0x543807 ;
materialDiffuse:  0xc6901d;
materialSpecular: 0xfdefce;
materialShininess: 27.8974.

This is the result I get:

Which seems very strange to me, I've seen other images of Ashkhmin-Shirley implementations on the web, and they aren't similar. This is an example:

I want one like this !! Maybe I am using wrong values of phi and other values? Or there's something wrong in the formula?


texts: matrices and nesting hierarchy with game objects

texts:
Let's say we have some game objects and they are nested to form a tree:

- A
  - B
    - C
  - D

If each of those have a matrix for the scale, rotation and translation, is it then easier that they inherit the properties from the parent as well or not?

If I do make them inherit from the parent then:

+ If I wan't to test if a point is inside C then I can get the inverse matrix and do a test.
  No need to worry about the matrices of A and B.

+  I can draw C directly for example without the need of applying the matrix of A and B.

If I don't make them inherit:

+ rotating C is more easy for example, cause there is no need to subtract from the parent to get correct values.

+ translating one specific entity is more easy cause there is no need to update the children.

- Testing if a point is inside for example is harder, cause all the matrices up to the root of the be applied.

What is more common / recommended? I'm guessing it makes more sense that children don't inherit from the parent but just start with a identity matrix instead.
If someone knows how blender is doing this then please tell me.


texts:
Possible Duplicate:
  Any interesting thesis topic?

I just wanna know what are the points of research in nowadays games. As I am Teacher Assistant and I must make a master thesis and I wanted to make the Thesis about games and contribution to game society the problem that all my faculty stuff are from old era where word games mean to them cards and chess boards only so they are useless to help me in finding a research point in gaming field

also I know most of research may be in GPU stuffs (Graphics) or in AI stuffs

But when I think I don't know from where to start and how to get a good research point to work on.

So if anyone can help I will be appreciated :)


texts: I was wondering on the programming methods which are used to detect when a player is using an Aimbot/AutoAim cheat.


texts: Passing Gameobject to another script in unity 3d

texts:
I'm trying to pass a gameobject from one script to another runtime attached script. My fisrt script is attached to the FirstPlayerController and the gameobject is not dragged in the editor, but is picked up and carried in the script. All i want is to pass the gameobject to the CameraController class to as make the second camera follow that object. Below is what i've tried so far. I dont want to access the gameobject with the tag, because there are more gameobjects that can be picked up. I want to access the carried object to the cameracontroller class.

Thanks!

Pickupobject.cs

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

public class pickupobject : MonoBehaviour
{
    GameObject mainCamera;

    bool carrying;

    public GameObject carriedObject;

    public float distances;

    public float smooth;

    float speed = 1000f;

    new Camera camera;

    // Use this for initialization
    void Start()
    {

        mainCamera = GameObject.FindWithTag("MainCamera");

        camera = GameObject.FindWithTag("secondCamera").GetComponent<Camera>();

        camera.enabled = false;

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.T) && carrying)
        {
            carrying = !carrying;

            ThrowBall();
        }
        if (carrying)
        {
            carry(carriedObject);

        }
        else
        {
            pickup();
        }

    }

    private void pickup()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {

            int x = Screen.width / 2;

            int y = Screen.height / 2;

            Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(new Vector3(x, y));

            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                pickupable p = hit.collider.GetComponent<pickupable>();

                if (p != null)
                {
                    carrying = true;

                    carriedObject = p.gameObject;

                    //camera.enabled = true;

                   // camera.gameObject.AddComponent<CameraController>();

                    //carriedObject.AddComponent<MovingBall>();

                }
            }
        }
    }

    void carry(GameObject o)
    {
        o.GetComponent<Rigidbody>().isKinematic = true;

        o.transform.position = mainCamera.transform.position + mainCamera.transform.forward * distances;

    }

    //void CheckDrop()
    //{
    //    if (Input.GetKeyDown(KeyCode.U))
    //    {
    //        Drop();
    //    }
    //}

    //void Drop()
    //{
    //    ThrowBall();

    //}
    void ThrowBall()
    {

        mainCamera.SetActive(false);

        camera.enabled = true;

       // carriedObject.AddComponent<CameraController>();

        camera.gameObject.AddComponent<CameraController>();

        carriedObject.AddComponent<MovingBall>();

        carriedObject.GetComponent<Rigidbody>().isKinematic = false;

        carriedObject.GetComponent<Rigidbody>().AddForce(0f, 0f, speed);

     }

}

CameraController.cs

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

public class CameraController : MonoBehaviour {

   public GameObject icosphere;

    public GameObject abc;
    Vector3 offset;

    // Use this for initialization

    void Start () {

        icosphere = GameObject.FindWithTag("purpleball");

        offset = transform.position - icosphere.transform.position;
        }

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

            transform.position = icosphere.transform.position + offset;
    }
}


texts: What does the "DXGI Flip Model Swapchain" setting in Unity do exactly?

texts:
I'm preparing a Standalone Unity game for Windows and Mac.

There is a checkbox in Player Settings called "Use DXGI Flip Model Swapchain for D3D11", which seems disabled by default.

Needless to say, I don't understand this setting at all. The Unity documentation has this:

  Flip model ensures the best performance. Disable this to fallback to
  Windows 7-style BltBlt model. This setting affects only D3D11 graphics
  API on Windows 8.1 or greater.

  Note that even if the flip model is enabled, the BltBlt model will be
  used in exclusive fullscreen mode to reduce input latency.

It doesn't exactly tell me what this is (I literally don't know what most of that means) - but it almost seems like there is no reason not to have it enabled.

Can someone explain the pros and cons of this setting? Under what scenarios would I want to enable/disable it?

Since disabling it fallbacks to the Windows-7 style, it almost gives the impression that enabling this might make the game less compatible on Windows 7?


texts: Why do XNA/Monogame models create new BasicEffect instances?

texts:
My question is fairly straightforward, I think. Using Monogame, when I load a model using contentManager.Load<Model>("Model"), the model's mesh has a BasicEffect attached. That means that if I load multiple models, I'll have multiple BasicEffect instances created, which seems wasteful. Based on other questions I've seen here (and based on instinct), I shouldn't need multiple effects for rendering simple models, but those effects are created by the content pipeline when the model is imported.

How do I resolve this problem? Is there a way to tell Monogame to not create effects on load, or do I have to override the effects created by the models manually? Is there something I'm missing in my logic?


texts: Is it unprofessional to leave game resources to the open eye?

texts:
I'm still having problems packing my resources, after going through complicated APIs and basically just zip files which are exhausting my brain, I thought I could also pack the game with the resources visible to the human eye, in a simple folder.

Would that be unprofessional? Personally, I've never even seen games do that, it would basically mean that the player could just edit whatever he wants in the game, like go in map1.txt and add an X somewhere to create a wall, or change the player sprite to a pony in MS PAINT.


texts: Unity Engine: How to change mointor/desktop resolution in 4.5.3 and higher

texts:
As of unity 4.5.3, Screen.SetResolution and the Unity Resolution Display Dialog, by default, no longer change the monitor/desktop resolution. Instead, it only changes the render target resolution for the game. This means that if you run a 1024x768 resolution on a widescreen monitor, your cursor can travel into the letterboxed area, outside of the window bounds, even when running in full screen mode. This is not the desired behaviour for our game.

This was described in the Unity 4.5.3 release notes:

"Windows Player: The default full-screen mode no longer changes the desktop resolution, so things like IME text input work."

I would like to actually change the desktop resolution. The change log suggests there is some non-default full-screen mode that will actually change the desktop resolution... How do I do this?


texts: Android Game Development. Type Usage for Entity Positions

texts:
I've recently started developing on Android and have made some basic apps. I now wish to start development on a game project. I have intermediate skill in Java and will be developing with that language in mind. I also have made a couple games for PC in java before. I will be using Native Android Studio for development and not an Engine/Framework.

My question is what is the preffered way to store object positions in Android for a 2D GAME.
The options I have right now are listed below:

Int (Very basic, not precise)
Float
Double
Custom Vector ADT
Other native Android Type.


texts: Unity custom font all glyphs on top of each other

texts:
I'm trying to create a custom font to use (just for numbers). I've divided a 1280x512 file into a 5x2 grid of 256x256 spaces, put my custom drawing into the boxes through 0 to 9, saved it as transparent PNG. Here is a screenshot from Photoshop:

I've created a custom font, made the ASCII start offset 48, left everything default, created 10 character rects from index 0 through 9. Here is a screenshot showing everything clearly instead of writing everything one by one:

On the sixth element UV Y becomes 0, the rest goes the same.

I create a default GUI text, select my font and write 0123, but here is the result:

All the characters are on top of each other. The font is not obeying the Advance property. I've tried different values but it doesn't work for any positive value for the advance property. If I give a negative value, it works (e.g. puts the character at the right, as if I'm using a RTL language like Arabic) but of course, this is not what I want. If I type just one character it displays perfectly at the right place so I don't think there's any UV issue here. It really looks like I'm doing something wrong with the Advance value, but whatever I've tried (positive, negative, zero, huge numbers, fractions etc.) it doesn't work (with the exception of negatives that I've explained) I'm on Unity Personal 5.4.3f1.

What am I doing wrong?

UPDATE: Just updated to the new 5.5 version, still the same.


texts: How do I convert a panorama image into a skybox?

texts:
I have two panoramas (1, 2) that are the same but are shaped a little different.

I don't care which one, but how should I go about converting them into a Skybox? I was looking for something like this:

(Image source here.)

How can I do this? I will use an image editing software if I have to.


texts:
I want to move my object with an acceleration in the proper direction.  For example if I have these values:

friction = 0.3;
direction = 180;
speed = 5;

For making it clear, I need a formula to create a linear acceleration.


texts: What alternatives are there for creating Keyboard/Mouse controls in LWJGL?

texts:
So I'm currently working my way through openGL tutorials, using LWJGL to do all my work in. However as I get to the part on how to access Keyboard and Mouse events in this library, I stumble across this little gem:

public static void poll()

Polls the keyboard for its current state. Access the polled values using the isKeyDown method. By using this method, it is possible to "miss" keyboard keys if you don't poll fast enough...
(from http://www.lwjgl.org/javadoc/org/lwjgl/input/Keyboard.html#poll())

So in order to make use of Buffered Input (as the top answer in LWJGL multiple keyboard/mouse input checks calls it) you have to use this poll() method.

This means that no matter what I do, I will miss key presses if I use LWJGL for this. I have made a test with this bit of code:

while(Keyboard.next()) {
    int character = Keyboard.getEventCharacter();
    int key = Keyboard.getEventKey();
    String charName= Keyboard.getKeyName(key);
    System.out.println(charName+""+character);
}

When pressing the buttons Z X C V at the same time, an example output is as follows: Z122
V118
X120
C0
V0
Z0

As you can see the C press and X release aren't found in the buffer. In some cases a single keystroke had both the press and release missing from the buffer.

I need this to not be the case and polling faster doesn't solve the issue at all (why would that even be a solution?). So what are the alternatives for this system?

(P.S. Yes pressing those 4 buttons at the same time was properly recorded in other applications)


texts:
I have served Google and I found that there are many 3D game engine also I have another question here

Do Playfish and Zynga use Flash game engines?

and I know that away3D is used for social media games on Facebook

but I'm confused now which one is the best and will be good and easy to start with as I'm very new in game development

so if anyone can advice me I will be thankful

also if anyone can support me with tutorial or book that may help me this is will be great

Thanks in Advance


texts: Hi so i am making a small sort of physics engine, but if your fps is really slow the physics will update slower and objects will move slower. How do i make the speed of objects greater if the fps is lower so that on a computer with 5 fps the object will land at the same time as on a 60 fps computer? (just with that slow framerate)


texts:
What heuristics do programmers use in A* pathfinding for NavMeshes?

NavMesh = Navigation Mesh, its a type of pathfinding that uses meshes instead of waypoints.


texts: C++11 & Efficient Networking ClientServer"Zone(s)"

texts:
I am building both an engine and a networked game at once because I'm completely insane. The original design/plan was to use internal Unix sockets for each "zone" for server<->zone communication, with UDP for server<->client(s) communication.

My conundrum is this: It seems like there are a variety of ways to handle getting packets from a client to the intended "zone", not none of them seem particularly efficient.

Simply move data from a singular queue to the intended zone server, via data objects within code.
(Pro: Simple  // Con: Potentially slow as molasses in a Canadian winter.)
(Somehow) Allow Server and Zones to communicate via Unix sockets, with a networking class/wrapper to pass packets into a "pool" for redistribution to Zones.
(Pro: Unix sockets, from my reading, tend to be fairly quick.  // Con: Need to re-evaluate how I am currently handling packets and the redistribution of packets makes it too similar to #1 for my liking.)
Use the underlying messages system on Linux. Ref
(Pro: Crazy fast for large objects. // Con: No idea how to implement at the moment.)

Additionally, if there is a specific text, document, or book(s) that I should be hitting instead of harassing everyone here, PLEASE let me know! Not at all afraid to spend a week tearing through a 200+ page tome.

Thank You!


texts:
I create a Window XNA game project from the template in Visual studio 2015. Then I right click and set the property to console application because I think it is convinient to use Console.WriteLine() for debugging.

In the game constructor I add

graphics.PreferredBackBufferWidth = 1920;
graphics.PreferredBackBufferHeight = 1080;
graphics.IsFullScreen = true;

Now the console text flicker. I use Console.Clear() the first thing I do in Update(). When I run the game in a window then the console text do not flicker. I even add counter to not update the text every time Update() is called and the console text still flicker in full screen mode. The same problem is there when I start form Windows Powershell. (The exact same thing do not flicker with MonoGame though.)


texts: How likely will I be able to get a job in game design with a masters in computer programming?

texts: I'm currently attending college and am almost finish with my Bachelors in Computers science.I plan on getting my masters in computer programming in hopes that it will help me get into game design. If not I at least will have a fallback plan in any other IT related field. I'm just curious as to how likely it is to happen for me.


texts:
I have two coordinate systems, like so

How can I transform a point on the one of the coordinate system to other ?

Pxyz = M . Px'y'z'    what is M ?


texts: I've watched a video on Parametric UV's but I cannot understand how to calculate, the Parametric UV's on a flat surface or a sphere.  Should I perceive Parametric UV's the same way as a UV map, which is between 0-1 ?


texts: Data structures for interpolation and threading?

texts:
I've been dealing with some frame-rate jittering issues with my game lately, and it seems that the best solution would be the one suggested by Glenn Fiedler (Gaffer on Games) in the classic Fix Your  Timestep! article.

Now - I'm already using a fixed time-step for my update. The problem is that I'm not doing the suggested interpolation for rendering. The upshot is that I get doubled or skipped frames if my render rate doesn't match my update rate. These can be visually noticeable.

So I'd like to add interpolation to my game - and I'm interested to know how others have structured their data and code to support this.

Obviously I will need to store (where?/how?) two copies of game state information relevant to my renderer, so that it may interpolate between them.

Additionally - this seems like a good place to add threading. I imagine that an update thread could work on a third copy of the game state, leaving the other two copies as read-only for the render thread. (Is this a good idea?)

It seems that having two or three versions of the game's state could introduce performance and - far more importantly - reliability and developer productivity problems, compared to having just a single version. So I'm particularly interested in methods for mitigating those issues.

Of particular note, I think, is the problem of how to handle adding and removing objects from the game state.

Finally, it seems that some state is either not directly needed for rendering, or would be too difficult to track different versions of (eg: a third-party physics engine that stores a single state) - so I'd be interested to know how people have handled that kind of data within such a system.


texts: how to spawn object at tip of rotating object

texts:
Engine: Gamemaker Studio

I'm learning to code in GML and I am having difficulty in having my bullets be created in the desired position, the front of the object firing them. Here's how it presently looks. I made the "player object" transparent to see the bullets traveling "under" it for demonstration purpose.

Here's the code of the bullet creation:


texts: How does displacement mapping generalize bump mapping?

texts: This PDF discusses bump mapping, a special case of displacement mapping. A surface is represented as a function \$\overrightarrow{O}\left(u,\,v\right):\:\Bbb R^2\mapsto\Bbb R^3\$. In bump mapping, we shift this surface by \$\delta\overrightarrow{O}=B(u,\,v)\overrightarrow{N}\$, with \$\overrightarrow{N}=\overrightarrow{O}_u\times\overrightarrow{O}_v\$ the surface normal. What happens in more general displacement mapping? Do we, for example, replace \$B\$ with a matrix, or include multiples of \$\overrightarrow{O}_u,\,\overrightarrow{O}_v\$ in \$\delta\overrightarrow{O}\$? If there's too broad a variety of displacement maps to describe in one answer, I'll settle for one or more mathematically detailed references.


texts: How to keep loading screen for minimum time?

texts:
Making my first game and stuck at keeping the loading screen visible for some time. It shows for an instance and disappears. By using loadasync the previous scene runs in the background? Do i have to pause everything and then move to the next scene? Thank you! The code is as follows:

public void LoadNextLevel()
{
    StartCoroutine(LoadAsyncronously());
}
IEnumerator LoadAsyncronously()
{
    int nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1;
    loadingScreen.SetActive(true);
    AsyncOperation operation = SceneManager.LoadSceneAsync(nextSceneIndex);
    float progress = Mathf.Clamp01(operation.progress / 0.9f);
    slide.value = progress;
    yield return new WaitForSeconds(2);
    SceneManager.LoadSceneAsync(nextSceneIndex);
}


texts: Syncing first person arms and enemy character for struggle in games

texts: Some FPS have it where your arms are struggling or doing something melee to a character model. Both the arms and the character you're interacting with are sync'd up in the animation. What's the general idea behind how that syncing is done?


texts: How do you make a customizable 3D character with animation in iOS?

texts:
I want to build a character system in my game that is like the on in Mod Nation Racers or Little Big Planet 2. You have a basic and simple Character (which is animated) and you can now put stuff (cloth, hat, glasses, eyes, mouth) and skins (yellow skin, hairy skin, ...) on it, like a puppet.

(This is all for iPad / iOS with Objective-C)

Does anyone have some url for me to get me started?


texts:
I'm trying to compile a list of game mechanics, by which I mean high-level/meta game mechanics like Cooperation, Resource Management, Chance and Time Manipulation rather than low level mechanics like running, jumping climbing ladders, etc

Does any one have any suggestions or can point me to good existing lists? My WIP list is already proving to be quite useful to me in the way I think about games.


texts: What is the math behind the light effect in krakatoa?

texts:
I'd like to know the math behind the light effect in krakatoa (click here for an example).

Light source is traveling with particles, but how is shading done? Is it something simple, like Phong shading? Is it possible to implement such effect in real time on GPU?


texts:
I'm asking about a very small domain.  One-off extension scripts.  IE, defining a new weapon for scorched earth.

When providing and API for small extension I've seen two approaches.

The API exposes classes that the extender then subclasses, overriding the needed methods.

--# weapons/flame_missile.lua

--#extender pulls in a predefined weapon base class
require "weapon.missile"

--# luabind syntax for classes
class "flame_missile" (missile)

function flame_missile:__init()
   self.hotness = 10
   self:set_cost(42)
end

function flame_missile:on_hit( who )
   who:take_damage(self.hotness)
   who:ignite()
end

In the other approach the api just exposes accessors and sandboxes the script, re-executing the file with each new missile and using the globals as the instance's state.

--# weapons/flame_missile.lua
hotness = 10
cost = 42

--# extender just knows that an on_hit function will be called
--# when the missile hits something.
function on_hit( who )
   who:take_damage(hotness)
   who:ignite()
end

NOTE: in my example who's api is OO.  I'm not interested in whether OO should be used in the extension API.  I'm more interested if OO should be used to incorporate user extensions into the game.

The first one feels more C++-y.  So I'm a little more comfortable with from a software engineering standpoint.  However,  one-off scripts don't need to fit together into a larger architecture.  Further, they could be written by less proficient coders, so all the fancy OO might be lost on them.

I really like how concise the sandbox approach is.  But it's a little limiting (only one missile per file, inheriting behavior from another weapon is no longer possible.  I'd really like to define my extension api like this but I'm a little wary as it's a radical departure from classic C++ programming style.

Which method do you prefer?
Have you had any bad experiences with one or the other?
Is there an even better way to elegantly incorporate extensions into the game?


texts: Observing particular Port for measuring network game performance

texts:
How can I check/inspect the performance of some network application via observing the port it used, I want to test the performance of my network game.

If my game is using port 1009, how can I check the different parameters, like data outflow, inflow and other metrics on this port?


texts:
hey i am studying different types of shaders in directx.
and it comes to hull shader.
so i write hlsl codes for both constant hull shader and control point hull shader in same file in visual studio 2019 .

i compile this file
 and this is showing these errors

the shader type is hull shader and 5.0 model.

struct VS_OUT
{
    float3 pos : TEXCOORD0;
};

struct Patch
{
    float edgeTessFactor[3] : SV_TessFactor;
    float inTessFactor : SV_InsideTessFactor;
};

struct HS_OUTPUT
{
    float3 pos : TEXCOORD0;
};

Patch ConstantHS(InputPatch<VS_OUT,3> patch, uint pI:SV_PrimitiveID)
{
    Patch p;
    p.edgeTessFactor[0] = 3.0f;
    p.edgeTessFactor[1] = 3.0f;
    p.edgeTessFactor[2] = 3.0f;
    p.inTessFactor = 3.0f;

    return p;
}

[domain("tri")]
[partitioning("fractional_even")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ConstantHS")]
[maxtessfactor(16.0f)]
HS_OUTPUT ControlPointHS(InputPatch<VS_OUT, 3> patch, uint i : SV_OutputControlPointID, uint pI : SV_PrimitiveID)
{
    HS_OUTPUT output;
    output.pos = patch[i].pos;

    return output;
}

any advice would be really helpful.


texts: Unity tilemap collider not colliding with rigidbody

texts: In the wireframe you can see the tilemap collider for this hill. The red circle falls right through however. The circle has a 2D rigidbody attached. Everything is on the Default sorting layer and on layer order 0.


texts:
I have a HLSl pixel shader that I'm using to create a deferred buffer, I have simplified the code to show you:

struct PS_INPUT
{
    float4 PosWVP                   : SV_POSITION;
    float4 NormalWorld              : NORMAL2;
};

struct PS_OUTPUT
{
    float4 PosWorld                 : POSITION;
    float4 NormalWorld              : NORMAL2;
};

PS_OUTPUT main(PS_INPUT input) : SV_Target
{
    PS_OUTPUT output = (PS_OUTPUT)0;

    output.PosWorld = input.PosWorld;
    output.NormalWorld = input.NormalWorld;

    return output;
}

When I compile this code, I get this warning warning X3576: semantics in type overridden by variable/function or enclosing type, what is this warning and how can I fix it?


texts: Rigged through Blender (Rigify) and Errors in Unity

texts:
I am working on a Unity scene and as the 3D model is missing the bones, I ended up going to Blender for the rigging.

For that, I followed the procedure that Unity suggests by using the add-on Rigify. I was also following this tutorial, which was really helpful.

After exporting from Blender (in .fbx) and importing it on Unity, I went through the configurations (as @vcard suggested here)

In the "Rig" section, I pressed the button "Configure" (to configure the Avatar Definitions) and came across an error "Character is not in T pose".

I solved this one quite fast by accessing the menu "Pose" (in the Inspector) and then "Enforce T Pose".

After that, back in the scene, I came across the following error on the Inspector:

  Invalid Avatar Rig Configuration: Missing or invalid transform:
  Required human bone 'Head' not found.

I went straight to the configurations and decided to add the specific bones to the Head that appeared on the inspector (in the Avatar Definitions configurator). With that, I came found out that the problem is really the organization where there were placed by Rigify.

Any guidance is appreciated.


texts: Unity or OpenGL for a real time strategy game?

texts: I'm trying to recreate an old game I use to play back in the day called Evony but I'm not sure what would be the best way to accomplish this graphically. It was originally written in Flash and I'm contemplating whether to do it using Unity or openGL. I'm not really sure how these types of games are made graphically, I looked at Clash of Clans but all it said is that they use "C++" so I'm lost. How would I go about making these types of games graphically using "C++" as most of these types of games are made for the android platform. I was thinking of using Unity but I'm afraid it would probably be too "bulky" and might make the game run slow, I want to be able to make it in C++ if possible so it can be more efficient. So again, how should I go about this?


texts: When are Unity scripts actually disabled?

texts:
When I disable an active script in unity, will it be disabled then and there, or will it only be disabled at the end of the frame?

For example, if I disable a certain script from within a "OnCollisionEnter" event method, will the "disabled" script still perform it's Update method for this frame?


texts: Using DLL's for a cross-platform Unity Game

texts:
Just a quick theoretical question so I don't hit a landmine further down development. In my current project, I have quite a lot of dll's that I made myself for use in Unity. If I were to develop for Android, would these dll's still function or is there another library format that Unity prefers to use? Basically, I'm looking for a rundown of all the ways you have to import libraries into Unity for use on a specific platform. For example,

1.) .dll files. Can you use them on other platforms?

2.) If not, how would I have to recompile code to allow me to access it the same way I currently do on a different plaform?


texts: Programmatically set color of Box2D body's sprite or image

texts:
In my basic Cocos2D + Box2D iPhone app I have a bunch of circular Box2D bodies.  I'd like to change the color of the circles programatically.  What's the easiest way to do this?

So far I'm just assigning a CCSprite* to the b2body->userData.  So perhaps I can change the colors in my sprite sheet programmatically?  Seems like there's an easier way.  I'm just not sure what it is.

Cheers!


texts: Best practice for designing a risk-style board game

texts:
I'm just trying to figure out how to set up the code for a game like risk...

I would like it to be extensible, so that I can have multiple maps (ie- World, North America, Eurasia, Africa) so hardcoding in the map doesn't seem to make a whole lot of sense

I'm a bit confused on how/where items should be stored/accessed.

Here are the objects I see the game theoretically using:
-Countries/Territories
-Cities (Can be contained within territories)
-Capitols
-Connections
-Continents
-Map
-Troops

At the moment, I feel like:
-A map should have a list of continents and countries. The continents would be more of a 'logical' thing where the continents would just be lists of countries that are checked for bonuses at the start of turns
-Countries should have a list of countries that they're connected to for the connections

What I can't figure out is: Where do I store the troops? Do I have an object for every single troop or do I just store the number of troops on a country object as an integer?

What about capitols and cities? Do those just have a reference to the country they reside  in?

Is there anything I'm not seeing here that's going to screw me over in the long run with the way that I'm thinking about things now?

Any advice would be appreciated.


texts: How do game developers target multiple platforms (Xbox 360, PS3, PC and Linux)?

texts:
How do game developers target multiple platforms at once?  For example, Xbox 360, PS3, PC and Linux.  For 2D games, is it possible to also target the iPhone?  I'm be interested in engines used (2D/3D, etc), how the build pipeline is setup and generally how much of the "core code" can be centralized without having to write platform specific code branches.

Or, if completely separate code trunks are usually maintained for each platform, how are libraries / code reused (in terms of linking and modularization)?


texts: How to use polymorphism with the Unity editor

texts:
For example:

[System.Serializable]
public class A
{
    [SerializeField]
    public int x;
}
public class TestA : MonoBehaviour
{
    [SerializeField]
    public A a = new A();
}

[System.Serializable]
public class B : A
{
    [SerializeField]
    public int y;
}
public class TestB : TestA
{
    // Not legal, I know. Considering Unity forbids the use of constructors in
    // monobehaviour classes, I have no idea how I'd do this.
    a = new B();
}

Given that this MonoBehaviour class "TestA" exposes an "A" object, I'd like to override this default value so that when a MonoBehaviour of type "TestB" is attach to a game object in the editor, an object of type "B" is exposed.

Perhaps I'm better off looking into creating custom property drawers, but I'm wondering if there is a way to do this with the default editor.


texts: Can you load all assets inside an Addressable folder?

texts:
So, I have a folder marked as addressable. This folder has many sub-folders, which might have more sub-folders, ultimately having some .png images.

I would like to load every single Sprite found in my main folder and its children (i.e. recursively).

public static AsyncOperationHandle<IList<TObject>> LoadAssets<TObject>(IList<IResourceLocation> locations, Action<TObject> callback);
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(object key, Action<TObject> callback);
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<object> keys, Action<TObject> callback, MergeMode mode);
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<IResourceLocation> locations, Action<TObject> callback);

The first, third and fourth seem to take a list of keys for individual addressable assets (e.g. the actual Sprites), which is not what I want. I just want to provide the key for the parent folder, and then get all the sprites in it or its sub-folders.

So, the second function seems a bit promising. I would've expected to use it like this:

Addressables.LoadAssetsAsync<List<Sprite>>("Assets/MyMainFolder", myCallback);

But it just tells me that the key is invalid. I've made sure that the folder is addressable, it has that key, and the group has been built.

So my question is: is there a way to load every addressable asset inside an addressable folder? Like how AssetBundles worked.

Unity 2019.3.0f3.


texts:
I am programming a 2D sidescroller in python and pygame and am having trouble making a bullet go farther than just farther than the player.  The bullet travels straight to the ground after i fire it.  How, in python code using pygame do I make the bullet go farther.  If you need code, here is the method that handles the bullet firing:

    self.xv += math.sin(math.radians(self.angle)) * self.attrs['speed']
    self.yv += math.cos(math.radians(self.angle)) * self.attrs['speed']
    self.rect.left += self.xv
    self.rect.top += self.yv


texts: How to manage loads and memory usage and process in unity

texts:
I want to know whether level and scene management for memory and process management is handled by Unity, or if the developer has to handle these kinds of concerns.

For example, imagine you want to develop an open world game, and you just start adding prefabs of people and cars and buildings and... until it's certain the target device can't handle all of them at same time. How can I manage the amound of content that is processed in the game?

Is this management handled automatically by Unity, or do I have to implement some techniques for this kind of work?


texts: Does Unity3D custom shader use its default GPU or CPU skinning automatically?

texts:
I'm writing my own shader in mobile, but was wondering if it uses default GPU or CPU skinning feature in Unity3D?

I'd like to use GPU skinning and already enabled GPU skinning. Is there any way to determine which (GPU or CPU) was actually used?

My shader is as below:

 Shader "Mobile Custom/Specular Map" {
 Properties {
     _ShininessColor("Shininess Color", Color) = (1,1,1,1)
     _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
     _MainTex ("Base (RGB)", 2D) = "white" {}
     _SpecMap ("Specular Map", 2D) = "white" {}
 }
 SubShader {
     Tags { "RenderType"="Opaque" }
     LOD 250
     Cull Back

     CGPROGRAM
     #pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap halfasview interpolateview noshadow nofog nometa nolppv noshadowmask

     inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten) {
         fixed diff = max (0, dot (s.Normal, lightDir));
         fixed nh = max (0, dot (s.Normal, halfDir));
         fixed spec = pow (nh, s.Specular * 128) * s.Gloss;

         fixed4 c;
         c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
         UNITY_OPAQUE_ALPHA(c.a);
         return c;
     }

     sampler2D _MainTex;
     sampler2D _SpecMap;
     uniform float4 _ShininessColor;
     half _Shininess;

     struct Input {
         float2 uv_MainTex;
     };

     void surf (Input IN, inout SurfaceOutput o) {
         fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
         o.Albedo = tex.rgb;
         o.Gloss = tex2D(_SpecMap, IN.uv_MainTex) * _ShininessColor;
         o.Alpha = tex.a;
         o.Specular = _Shininess;
     }
     ENDCG
 }

 FallBack "Mobile/VertexLit"
 }


texts:
Whenever I use discard or an if statement in my shaders, I get an error message with the text

<qgl2DrvAPI_glAttachShader:398>: GL_INVALID_VALUE

I think this is a version problem, but I'm really not sure.


texts:
I've been a java developer for 3 years, and I got one opportunity to explore  JOGL.

Is it a good idea to move into JOGL from being a core java developer  ?


texts: How can I change one prefab without changing all prefabs?

texts:
I have this code that will spawn in a lot of prefabs. It then edits the prefabs. The problem is that every time it changes a prefab it will reset and move all the other ones.
Can you please explain this and maybe find a solution.

Here's the code:

void createAtom (int number, string symbol, string name, int x, int y) {
    Transform newatom = Instantiate (P_atom) as Transform;

    newatom.parent = this.transform;

    newatom.name = symbol;
    newatom.localScale = new Vector3 (0.35F, 0.35F, 1F);

    int posx = numbersx[x-1];
    int posy = numbersy[y-1];

    newatom.localPosition = new Vector3 ((posx * 2.1F) + (posx < 0 ? 1F : -1F), posy * 2.1F, -1F);//.GetChild (1);

    Debug.Log (number + symbol + name + x + y);
    TextMesh[] child = GetComponentsInChildren<TextMesh> ();
    child[0].text = symbol;
    child[1].text = number + "";
    child[2].text = "x0";
}


texts: How can I check if my object just stopped rotating this frame?

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

public class RotateRandom : MonoBehaviour
{
    private void Update()
    {
        if(Whilefun.FPEKit.FPEInteractionManagerScript.naviRotate == true)
        {
            transform.Rotate(0,0,100);
        }
        else
        {
            transform.eulerAngles = new Vector3(0, 0, 0);
        }
    }
}

I set the flag to true and false in another script.
And here I want that each time the transform stops spinning, it should revert to looking forward once.

But since I wrote transform.eulerAngles = new Vector3(0, 0, 0); in the Update method, it will try to go back to facing forward every frame. I want it to do it only once each time it stops spinning.


texts: How can I use OpenGL and D3D to render to the same window at the same time?

texts:
I have main render loop in which initial drawing is done via OpenGL to an SDL window, and after that the same window handle is passed to a Direct3D device, which does subsequent rendering.

Once I execute the program it will initially draw the OpenGL scene, and then do Direct3D drawing but that latter drawing overwrites the OpenGL work.

What I want to see is both drawings in parallel. How can I accomplish that?


texts: Possible to draw a select portion of a render target? (in XNA)

texts:
I'm going to try to do this in reverse fashion and skip straight to the punch line, and then give the back story afterward:

Is it possible to, after drawing a scene to a RenderTarget2D, only draw a select portion of the RenderTarget2D, if I don't want the entire thing?

I'm using xTile to manage world data in my game (it's a great piece of work, colinvella [xTile's author] has made an amazing product), and for the most part it works great. xTile supports parallax effects in its layers to add some wonderful depth to 2d scenes, which was great, until I implemented a dynamic split-screen system into my game. Wanted to make a co-op game that wouldn't require players to be in close proximity to each other, so I made it so that if the players separate too far apart, the singular full-screen viewport 'snaps-apart', and is replaced by two split-screen viewports, which then smoothly transition to their respective player targets. The effect is pretty smooth aside from the part where the parallax backgrounds become skewed once the viewports split, because xTile's ratio for handling parallax effects is dependent upon viewport size. This is unfortunate, because the effect would otherwise be really snazzy, but the backgrounds become pretty heavily affected when the game goes from single-viewport to multi-viewport.
So, Colinvella suggests using rendertargets to record the scene at full viewport size, and then only drawing a portion of it. But as far as I can tell, that isn't even possible? That being said, I've never even used render targets before, so I'm still learning, hence the question here.


texts:
I am trying to learn Raknet with C# and I found it extremely confusing.

The Raknet tutorial seems to work well in C++. I have already made the chat server from the tutorial.

I am looking to do something similar in C# but I'm having trouble.

It seems that I need to compile Raknet using SWIG to have an interface to C#?
I found a project called raknetdotnet but it seems to be abandoned...http://code.google.com/p/raknetdotnet/

So my main question is what is the best way to use Raknet from C#?

The following information would also be very helpful:

A good tutorial for Raknet and C# together
Sample C# code for Raknet

I've done a lot of research but I'm still stuck.

Maybe Raknet isn't what I need after all?  Comments with more C#-centric alternatives would also be appreciated.


texts: Is it possible to create accelerated 3D graphics on Windows using one's own API?

texts:
Say I want to come up with a way to replace what OpenGL and DirectX specifications do: communicate with GPU to get some functions done that help hardware-acceleration and rapid drawing of screen data. Is it possible to write some mock-up copy that can communicate with the GPU the same way that, say, an OpenGL specification could or DX to drive the same functions (or similar ones)?

What I'm saying is, somebody somehow made a way to communicate with a device driver to get acceleration and faster graphics, 3-D functions, etc. Is it possible one can create the same "inbetween" library or software that can do pretty much the same thing -- interact  with the device driver and drive OpenGL/DX similar operations or some other specification, but using my own self-written procedures to do so?

In other words, is it possible to replace OpenGL/DX code that communicates with a graphics driver with your own code that does the same thing, but is instead written by you?

I'm not asking about writing a device driver, but writing something that communicates with it, such as how DX/OpenGL does. OpenGL is 100% open-source and you can see how every single function/operation/line of code works when you link with it and use a debugger, etc.

We know OpenGL usually doesn't directly interact with a GPU most of the time, and although it does sometimes, the identic function can easily be replaced by debugging.


texts: Game-App deep linking is working in all android phone, but it is not working in tablets . Do i need to add any manifest code to work it in Android?

texts: This is my manifest, which is used for App indexing auto complete and deep linking.


texts:
In virtually all shooting games that use ammo, there is also a maximum ammo limit, which often varies between different ammo types. One obvious advantage of using ammo limits is to control the scarcity of ammo, so that players cannot excessively hoard it and drastically affect the game's difficulty.

What factors affect the size of ammo limits? An obvious factor would be the rate of consumption; if an ammo type is used by rapid fire weapons, the limit for this ammo type should be higher. But it should be obvious that there are many other factors, since some types of ammo quickly run out and others never seem to. As a designer, what factors should guide my decision for ammo limits, and when/why would I deliberately constrain or expand an ammo type's limit?


texts: DirectX9 HLSL .cso file import to Visual Studio

texts:
I started to learn HLSL because I want to upgrade the graphics of an old game from 2004.
The game uses DirectX9, so I created a Vertex Shader with shader model 2.0 and
now, I have two questions:

After the compilation of the .hlsl file, what do I have to do with the .cso file? How I can include that file to my project/Visual Studio?
If the game uses DirectX9, can I use DirectX11 for the HLSL?

Thanks.


texts: Move Object to another Object's position on click Raycast

texts:
I have one object, a knight, that I click on and want to move around on terrain.

private void OnMouseDown()
{
   if (Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit, 10000))
    {
        if (unitSelected)
            MoveUnit(hit);
        else if (unitSelected && hit.collider == home)
            GoHome(hit);
     }
}

And

private void OnMouseDown()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        if(Physics.Raycast(ray, out hit))
            MoveUnit(hit);
    }
}

Both scripts work fine when clicking on the terrain.

The Problem

I want to click on different objects and send the knight towards whatever object I click on.

The knight does NOT move, though the object I click on registers a click (all objects have colliders).

Is Raycast the most appropriate way to do this? Checking another users question similar to mine, (how-to-move-one-object-to-another-objects-position) they seem to use a method similar to "Vector3.MoveTowards".

EDIT:

Moving my code from "OnMouseDown" to "Update" solves that issue. but is there a reason why OnMouseDown won't work or even how to make it work? I was trying to limit my code from going into Update as that's called every frame.


texts: Unity3d: keep working on the project in the editor while building for Android in command line

texts: Is it possible to keep working on the project in the editor while it's being built for Android in command line?


texts:
1I have a thesis project about dynamic difficulty in games and I'm focusing on Tower Defense genre. My plan let the enemy units or each units in a wave know that a tile on a path is dangerous (or many units have died there). When an enemy unit with a skill(for example area shield boost) pass or walks to a tile with the most units killed in that tile it will trigger the skill to prevent minimal damage to the wave. What algorithm would be suitable to achieve that?

PS: is this a good idea for a dynamic difficulty, if not suggestions are accepted.


texts: Is there a (family of) monotonically non-decreasing noise function(s)?

texts:
I'd like a function to animate an object moving from point A to point B over time, such that it reaches B at some fixed time, but its position at any time is randomly perturbed in a continuous fashion, but never goes backwards. The objects move along straight lines, so I only need one dimension.

Mathematically, that means I'm looking for some continuous f(x), x ∈ [0,1], such that:

f(0) = 0
f(1) = 1
x < y → f(x) ≤ f(y)
At "most" points f(x + d) - f(x) bears no obvious relation to d. (The function is not uniformly increasing or otherwise predictable; I think that's also equivalent to saying no degree of derivative is a constant.)

Ideally, I would actually like some way to have a family of these functions, providing some seed state. I'd need at least 4 bits of seed (16 possible functions), for my current use, but since that's not much feel free to provide even more.

To avoid various issues with accumulation errors, I'd prefer the function not require any kind of internal state. That is, I want it to be a real function, not a programming "function".


texts:
Currently I'm using XNA's ContentManager to load my content. For the unfamiliar the ContentManager deserializes classes from disk and keeps a reference for future requests.

I'm currently facing a problem with management, where for some resources I don't want to deserialize them repeatedly (e.g. a texture) but for others I do (e.g. destructible level geometry). As it is now when I replay a level I get back the original class with the player's changes.

For this reason I decided to inherit from ContentManager to provide some way of re-deserializing a resource to get a new copy (probably using the protected ReadAsset<T> method).

Now I'm thinking about how I should manage this. Ideally I want some way of saying you can re-use Textures, but not Levels (i.e. when a Level is requested it always deserializes a new instance).

While I think about that I'd also like to create my custom ContentManager with a view to get other niceties such as automatic unloading, on-demand or in advance loading of assets, pre-loaded place-holder assets etc.

How is this sort of class typically designed and how can I overcome my immediate problem (reloading particular types and re-using instances of others)?


texts:
I have the following script which I use for calculating the score

public class Score : MonoBehaviour {

    Score sc;

    void Start()
    {
        GameObject obj = GameObject.Find("ScoreSystem");
        sc = obj.GetComponent<Score>();

    }

    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.tag == "Ball")
        {
            sc.score++;
        }
    }
}

and this is the class where I increase the value

public class Score : MonoBehaviour {

    public int score;

    void Start()
    {
        score = 0;
    }

}

But the problem I have is that the value always stays 0 when I switch to a different scene. I even used this code to store the value and display in the next scene but it didn't work

void Update()
{
    PlayerPrefs.SetInt("score", score);
    PlayerPrefs.Save();
}

and this code for taking the value

score = PlayerPrefs.GetInt("score");

How can I store the latest value inside an Int and display it in the next scene and when I leave that scene it reverts back to 0?


texts: Method keep adding the same monster to the list

texts:
I'm creating a text based arena RPG where each day new monsters are added to a list, but with my current code, only one monster gets added to the list repeatly with the same stats (which for some reason keep increasing each day).
This method calls the creator.
public static List<Monster> MonsterOfTheDay()
  {
    int count = 0;
    List<Monster> MonstersListOfTheDay = new List<Monster>();

    while(count <= 5)
    {
      MonstersListOfTheDay.Add(Creator());
      count++;
    }

    return MonstersListOfTheDay;
  }

This is the creator
public static Monster Creator()
{
    Random random = new Random();
    Monster monsterChoosen = monsterListPrefab.Find(m => m.Id == random.Next(0, monsterListPrefab.Count -1));

    monsterChoosen.Level = random.Next(monsterChoosen.Level, monsterChoosen.Level + 3);

    //1Offensive, 2Defensive, 3Balance
    monsterChoosen.Type = (Types)typeList.GetValue(random.Next(1, typeList.Length));

    Console.WriteLine("Estou Aqui");

    int atributes = monsterChoosen.Level * 3;
    int spend = 0;

    Console.WriteLine("Estou Aqui");
    while(spend != atributes)
    {
      int chance = random.Next(0, 100);
      if(monsterChoosen.Type == Types.Offensive)
      {
        if(chance >= 0 && chance <= 60)
        {
          monsterChoosen.Str++;
          spend++;
        }

        if(chance >= 61 && chance <= 70)
        {
          monsterChoosen.Int++;
          spend++;
        }

        if(chance >= 71 && chance <= 85)
        {
          monsterChoosen.Agi++;
          spend++;
        }

        if(chance >= 86 && chance <= 100)
        {
          monsterChoosen.Vig++;
          spend++;
        }
      }
      else if(monsterChoosen.Type == Types.Defensive)
      {
        if(chance >= 0 && chance <= 60)
        {
          monsterChoosen.Vig++;
          spend++;
        }

        if(chance >= 61 && chance <= 70)
        {
          monsterChoosen.Str++;
          spend++;
        }

        if(chance >= 71 && chance <= 85)
        {
          monsterChoosen.Int++;
          spend++;
        }

        if(chance >= 86 && chance <= 100)
        {
          monsterChoosen.Agi++;
          spend++;
        }
      }
      else if(monsterChoosen.Type == Types.Balance)
      {
        if(chance >= 0 && chance <= 25)
        {
          monsterChoosen.Str++;
          spend++;
        }

        if(chance >= 26 && chance <= 50)
        {
          monsterChoosen.Int++;
          spend++;
        }

        if(chance >= 51 && chance <= 75)
        {
          monsterChoosen.Agi++;
          spend++;
        }

        if(chance >= 76 && chance <= 100)
        {
          monsterChoosen.Vig++;
          spend++;
        }
      }
      else if(monsterChoosen.Type == Types.Prefab)
      {
        spend++;
      }
      else
      {
        Console.WriteLine("Error");
      }
    }

    return monsterChoosen;
  }


texts: Suggestions for implementing a dynamic 2D level

texts:
I am working on a game that needs a level that is completely generated. Currently my approach is to draw textures for the levels pixel by pixel during the game (in XNA with SpriteBatch). This is too intensive unfortunately. The game has frame drops even when I only draw 1 level texture each draw cycle.

Here is an example of the current prototype. It is a simple sidescroller with the avatar swimming through a cave. The shape of this cave will alter throughout the level (textures and physics collision shapes). You can clearly see the boundaries of the level tiles in the screenshot below. These are generated just before they move into camera view.

For inspiration I looked at PixelJunk Shooter 2. These levels are obviously not generated, but some of the levels have movement. How do you guys think they implemented it? My guess is that the level and other objects in the game are actually flat 3d models, but I am not sure..


texts: Camera wont stay behind model after pitch, then rotation

texts:
I have a camera position behind a model. Currently, if I push the left thumbstick making my model move forward, backward, or strafe, the camera stays with the model. If I push the right thumbstick left or right, the model rotates in those directions fine along with the camera rotating while maintaining its position relatively behind the model.

But when I pitch the model up or down, then rotate the model afterwards, the camera moves slightly rotates in a clock-like fashion behind the model. If I do a few rotations of the model and try to pitch the camera, the camera will eventually be looking at the side, then eventually the front of the model while also rotating in a clock-like fashion.

My question is, how do I keep the camera to pitch up and down behind the model no matter how much the model has rotated? Here is what I got:

// Rotates model and pitches camera on its own axis
    public void modelRotMovement(GamePadState pController)
    {
        // Rotates Camera with model
        Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(angularSpeed);
        AddRotation = Quaternion.CreateFromYawPitchRoll(Yaw, 0, 0);
        ModelLoad.MRotation *= AddRotation;
        MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation);

        // Pitches Camera around model
        Pitch = pController.ThumbSticks.Right.Y * MathHelper.ToRadians(angularSpeed);
    }

    // Orbit (yaw) Camera around with model (only seeing back of model)
    public void cameraYaw(Vector3 axisYaw, float yaw)
    {
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisYaw, yaw)) + ModelLoad.camTarget;
    }
    // Raise camera above or below model's shoulders
    public void cameraPitch(Vector3 axisPitch, float pitch)
    {
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisPitch, pitch)) + ModelLoad.camTarget;
    }

    // Call in update method
    public void updateCamera()
    {
        cameraYaw(Vector3.Up, Yaw);
        cameraPitch(Vector3.Right, Pitch);
    }

NOTE: I tried to use addPitch just like addRotation but it didn't work...

UPDATE
I understand the problem Im having fully. While Im facing world-North or world-South, the camera pitches around the model like normal. But lets say I'm facing world-East. The camera will still point to the model regardless of the rotation, but when I pitch the camera, it will rise and fall in a clock-like fashion around the back of the model. So the camera itself is still pitching as to world's North and South. Not the model's North and South.


texts: How can I transform a point from world space to object space?

texts:
If I have an object space described by transformation matrix that should be applied to object to transform it to world space, what I have to do to transform point (world space) to that object space.

I guess it's more of a math question, but I believe gamedevs are more familiar with terminology.


texts: I have a GameScreen where I'd like to have a pause button. I've tried using an Image with a listener, but since my GameScreen isn't a stage, I can't use that in the inputProcessor. So my question is how should one create a clickable button outside a stage class?


texts: I'am maybe asking a stupid question, but can we mix OpenGl + SMFL and add to it some GLFW in the same SFML window ?


texts:
Can anyone point me to some information on what a modern video card architecture looks like? I'm particularly interested in understanding how my rendering engine will be executed by the GPU.

Ideally, I'd get two answers: one related to today's monster video cards and one related to today's mobile GPU's.

-- edit follows

Thanks for the input so far. Considering the proprietary and changing nature of video card hardware, it seems there's not the ideal answer that I was looking for. So I'll clarify and ask a couple very specific questions. (I guess I was hoping to get a resource similar to http://www.realityprime.com/articles/scenegraphs-past-present-and-future which would generally provide me with lots of information on hardware that might be relevant to me.)

First off, I'm quite familiar with the OpenGL pipeline. A google-images search for my question title, "video card architecture," reveals diagrams of various video cards which naturally seem to match the graphics pipeline. While this makes sense, and is helpful, it leaves out some details. I'll try to get at a couple specifics.

1) What happens when a texture change (glBindTexture(), or new sampler specified) is issued? Obviously, the command is queued and later processed by the video card, but is the texture loaded immediately into cache, or not until something attempts to sample that texture? I would expect the latter, partly because the texture may not entirely fit into such caches to begin with. How big are these caches, anyway?

2) Older video cards had hardware dedicated specifically for a given type of shader. Newer video cards reuse the same hardware for all types of shaders. Are these "stream processors" typically shared with other computations throughout the pipeline, such as culling?

3) It seems that progress related to video card hardware has largely been lead by innovation in software. Are there any interesting cases where the opposite is true? I still hope that there might be some resource that gives a detailed history of video card design, similar to the scenegraphs article linked above.

4) Mobile GPU was an ambiguous term. I'm hoping that eBusiness assumed I meant mobile as in laptop when he called me ignorant -- I was rather referring to the GPUs embedded in modern cell phones and tablets.


texts: Pygame Tile Based Character movement speed

texts:
Thanks for taking the time to read this. Right now I'm making a really basic tile based game. The map is a large amount of 16x16 tiles, and the character image is 16x16 as well. My character has its own class that is an extension of the sprite class, and the x and y position is saved in terms of the tile position.

To note I am fairly new to pygame.

My question is, I am planning to have character movement restricted to one tile at a time, and I'm not sure how to make it so that, even if the player hits the directional key dozens of time quickly, (WASD or arrow keys) it will only move from tile to tile at a certain speed. How could I implement this generally with pygame? (Similar to game movement of like Pokemon or NexusTk).

Edit: I should probably note that I want it so that the player can only end a movement in a tile. He couldn't stop moving halfway inbetween a tile for example.

Thanks for your time!
Ryan


texts: Generating a map in runtime for a simple top-scrolling racing game

texts:
I'm creating a simple top-scrolling racing game. The concept is quite simple - the player controls the car, which goes on a dynamically generated field with square blocks. Once the car hits a car, the game ends.

My first implementation was simply to put a few random blocks in each row being generated on the top of the screen, but this does lead to maps where going through is impossible.

What is the best algorithm for generating such type maps? My platform of choice is XNA and C#, if that's important.

EDIT: Here's an illustration: (pic)

In this case, there's no possible way for the player to pass.


texts: Why are rotations in 2D game engines often counter-clockwise = positive systems?

texts:
I was looking over the API for a game engine a friend was developing in her spare time. She made the decision to make positive angles rotate in a clockwise direction. This immediately struck me as odd. My intuition was that angle should be measured counter-clockwise. I envision the typical unit circle when thinking about 2D rotations:

Her reasoning for picking this convention was that she was using a "positive y" = "down" coordinate system. From a mathematical sense, it makes sense to me that rotations would be clockwise if you're using this orientation. sin(90 degrees) would give me y = +1, which would be in a downward direction on my screen. So shouldn't I be thinking about angles in a clockwise way?

Why have we arrived at the convention that rotations should be counter-clockwise then, even in engines where positive y is down?


texts:
Is there a tool that can convert a fragment shader from hlsl to glsl or glsl to hlsl? I do not want to use cg since it is not able to work on mobile platforms.

Is there a tool that can make it so I only write a shader once?

Thanks


texts:
Im making an editor in which I want to build a terrain map. I want to use my mouse to increase/decrease terrain altitude to create mountains and lakes essentially.

Technically I have a heightmap I want to modify at a certain texcoord that I pick out with my mouse. To do this I first go from screen coordinates to world position - I have done that. The next step going from world position to picking the right texture coordinate puzzles me though. How do I do that?


texts:
I'm using the Winforms sample on the app hub and everything is working fine except my spritebatch won't draw anything unless I call Invalidate in the Draw method. I have this in my initialize method:

Application.Idle += delegate { Invalidate(); };

I used a breakpoint and it is indeed invalidating my program and it is calling my draw method. I get no errors with the spritebatch and all the textures are loaded I just don't see anything  on the screen. Here's the code I have:

    protected override void Draw()
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        tileSheet.Draw(spriteBatch);
        foreach (Image img in selector)
            img.Draw(spriteBatch);
        spriteBatch.End();
    }

But when I do this:

    protected override void Draw()
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        tileSheet.Draw(spriteBatch);
        foreach (Image img in selector)
            img.Draw(spriteBatch);
        spriteBatch.End();
        Invalidate();
    }

then all of a sudden the drawing starts to work! but the problem is that it freezes everything else and only that control gets updated. What can I do to fix this? It's really frustrating.


texts:
I need a library which ensures me that the timing between frames are more constant as possible during an experiment of visual psychophics.

This is usually done synchronizing the refresh rate of the screen with the main loop.

For example if my monitor runs at 60Hz I would like to specify that frequency to my framework.

For example if my gameloop is the following

void gameloop()
{

// do some computation

printDeltaT();
Flip buffers
}

I would like to have printed a constant time interval. Is it possible with GLFW?


texts: Problem with Ogmo Editor (is Tiled Editor a solution?)

texts:
I made a level editor for a puzzle game with Ogmo Editor and gave it to our designer/level designer. When he downloaded and started Ogmo, his CPU went to 100%. I looked at my CPU usage while Ogmo is running, and it goes from 20% to 30% (which is also high for an application alike Ogmo). He has a Windows 7 VM running on his Mac and I have a normal Windows PC, can this be a problem?

I found a thread on FlashFunk forum that confirms that Ogmo has CPU usage issues. Has anybody maybe solved this issue?

The solution seems to use Tiled Editor, but I never used it before. Is it difficult to change a level editor from Ogmo to Tiled? Can they export in the same format (XML with CSV elements for my puzzle game)?

EDIT

I ended up re-making the level editor with Tiled. It wasn't difficult and the only problem was that the exported XML is slightly different. In Ogmo the layers names are exported as XML element names, and in Tiled all layers are exported as  elements with the layer name as the name attribute of the layer element.

My first question still remains: has anybody managed to solve the high CPU usage of the new version of Ogmo?


texts: How to create a puzzle where the player needs to rotate hexagons to connect to the neighbors?

texts:
I was researching different puzzle ideas and came across a game called Warframe that requires the player to hack a console to progress further into the level.

The player has to spin around the hexagons (randomly generated, and get more difficult later on) to link up the connections to other hexagon neighbors.  It's simple for the player to do, but also quite fun from my research.

How can I create something similar to this?

Edit:  To be more specific; I would like to know how to generate a puzzle like below and how to check for successful connections.  The graphics, animations, and player input I can handle.  I suppose it's more about the algorithms to create the puzzle and then check the conditions.

I couldn't figure out good search terms to find something similar.  So even if someone can point me in the right direction, that would be helpful.

I will be doing this in Unity / C#.

Example of doing a puzzle.


texts: Java code for client-server game on Android

texts:
I have developed a game on Android. Now I want to play it on wifi or 3G. I have game packets which I want to send form client (mobile) to server then to another client (mobile).

I don't know how to write code in Java to send the playPackets continuously to server and receive the playPacket continuously from the server to the clients.

I guess I have to use two thread one for sending and one for receiving.

Can someone help me with the code, or the procedure to write code for it?


texts: Making quick time events in my text adventure more noticable

texts:
I'm making a post-apocalyptic text adventure in Unity. One of the gameplay features I've added is a quick time events on certain parts. Whether a part is a quick time event is defined inside the story json data like this:

  "PartName": {
    "text": "",
    "choices": {
    },
    "timer": { // if this key exists, the timer event will be triggered..
      "time": "10",
      "nextPart": "" //what part it goes to when the timer ends.
    },
    "background": "" //background of part
  },

When the timer runs out, you'll be forced into a part where the player dies or a unfavorable decision is made that will effect you later on in the game.

Here's a screenshot of a part that contains a quick time event:

Notice anything? The timer is the circle(radial timer) in the right hand corner. My main problem is trying to make sure players know there's a quick time event happening. These will be rare occurrences since I don't want to over-do them(ex: a quick time event every couple of parts) so I feel like the average player will not know that there's a quick time event.

One way I've thought of addressing this issue is by stating what a quick time event looks like in the how-to-play section of my menu, but since that's "locked" away by a button (you have to click a button to get to the section), people may just skip it entirely since text adventures aren't really known for the most complex controls in gaming.

Other ways I've thought of addressing it:

Music cues

pros: I have complete control over what music I can put there
cons: Since some parts have a defined background music, it might not be noticed by the player

Background tints (changing color of background)

pros: Easily noticeable change and will be unique only to timed parts.
cons: Might look ugly or players may not notice the significance of why the background suddenly changed color

Large timer in the middle of the screen

pros: Easily noticeable and players will notice it's a timer
cons: May be obscured by a text and or look ugly.

So I need help either deciding which the best course of action will be to address the issue from the list above over


texts:
I'm creating a C# multiplayer game in Monogame using SignalR to update the enemy players positions.

This is my proxy.invoke:

        proxy.Invoke("UpdateEnemy", LocalShip.Position, LocalShip.AngleOfRotation, LocalShip.Id).Wait();

The server will take my parameters and send them to the enemies and also take their parameters and send them to me

If I call this method in the Update method the game is extremely laggy.

However if I call it in the Draw method it runs perfectly.

This doesn't seem right to me and I'm wondering does anybody know is there something I'm doing wrong here and why is this happening?


texts:
I have a low poly model that I made in Blender 2.8. Because it's low poly, it only has a material that's a mix between a diffuse and a glossy shader - it has no textures. The only thing I want to do is import the model into Unity3D with the diffuse and glossy shaders, just like it is in Blender.
Does anyone know how can I do this?


texts: How to enable depth test with QOpenGLWidget? It renders black screen

texts:
Currently I am writing a small application with Qt and OpenGl and I choosed QOpenGLWidget for rendering graphics.

That's how I declared my widget:

class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions{
     // Methods, slots, e.t.c
}

And that's the constructor:

GLWidget::GLWidget(QWidget *parent) : QOpenGLWidget(parent)
{
    /* Tried this, it didn't help.
    QSurfaceFormat format;
    format.setDepthBufferSize(24);
    this->setFormat(format);
    */
}

In my init function I set GL_CULL_FACE and GL_DEPTH_TEST:

void GLWidget::initializeGL()
{
    /* Some initialization stuff regarding the scene */

    glEnable(GL_CULL_FACE);
    glEnable(GL_DEPTH_TEST);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

}

And I really don't know why the widget renders the black screen.
Here are some pictures.
First one: with disabled GL_CULL_FACE and disabled GL_DEPTH_TEST.

Second one: with enabled GL_CULL_FACE and disabled GL_DEPTH_TEST. Maybe it's not a good picture, but I can assure you, you can see some surfaces through the other.

Third one: with enabled GL_CULL_FACE and enabled GL_DEPTH_TEST. Actually, it doesn't matter if GL_CULL_FACE is enabled. Anyway it renders the black screen.

And here's the image without any shading just to show you that the model is fine.

I tried to set the format manually, but it didn't help. Still the black screen:

QSurfaceFormat format;
format.setDepthBufferSize(24);
this->setFormat(format);

Oh and yes, I set glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); at the beginning of my paintGL() function.


texts: How would I make my player controls respond quicker?

texts:
I'm working on this game in Unity 2D where the user swipes to make a game object move in the direction that the user swiped in. Currently, when the user swipes it takes about a quarter of a second for the game object to respond and move in the new direction. What should I do to make the controls respond quicker? I know that with Input.GetAxis, I could make it Input.GetAxisRaw to make it more responsive. Right now it's like Input.GetAxis but I'm trying make it like Input.GetAxisRaw. (I can't use Input.GetAxisRaw because this is for a mobile game). Thanks.

private Rigidbody2D rb;
private Vector2 moveVelocity;

in void Update():

if (Mathf.Abs(lp.x - fp.x) > Mathf.Abs(lp.y - fp.y)) {   //If the horizontal movement is greater than the vertical movement...
                    if ((lp.x > fp.x)) {   //Right swipe
                        if(moveVelocity != Vector2.left) {
                            moveVelocity = Vector2.right;
                        }
                    }
                    else {   //Left swipe
                        if(moveVelocity != Vector2.right) {
                            moveVelocity = Vector2.left;
                        }
                    }
                }
                else {   //the vertical movement is greater than the horizontal movement
                    if (lp.y > fp.y) {   //Up swipe
                        if(moveVelocity != Vector2.down) {
                            moveVelocity = Vector2.up;
                        }
                    }
                    else {   //Down swipe
                        if(moveVelocity != Vector2.up) {
                            moveVelocity = Vector2.down;
                        }
                    }
                }

And void FixedUpdate():

void FixedUpdate() {
    rb.MovePosition(rb.position + moveVelocity * speed * Time.deltaTime);
}


texts: Help with Ragdoll snapping back to origin

texts: So I have a ragdoll system that is enabled when the player is hit by an enemy. When the ragdoll is enabled I disable the animator, wait 3 sec, then enable the animator and play a get up animation. However after those 3 sec the player just snaps back to it's prior position. Is there anything I can do to make the entire object follow along as for some reason a few of it's children stay put while the parent goes flying. I've tried implementing fixed joints but it has had no effect.


texts: How to make Canvas Unit/ Unity Units consistent size.

texts: I'm making an application within unity that leans heavily on UI but whenever I create new UI Elements they appear huge and I have to make a lot of logical concessions to get it to look normal. is there a way to change the Canvas pixels/unit value in the editor? A lot of the people with similar problems I see just are told "That's just how unity works, don't worry about it." but there has to be a better solution.


texts:
I'm trying to make a distortion effect similar to this:

However I'm not making a 2d screen space effect.  I'm applying it to a 3d scene and I want it to be placed IN the world, so it can be blocked by other 3D objects.  I know the general method for doing this is as a post-process effect applied to a 3D sphere, however I can't find any code/equations that work for that case.  All the ones I've found assume you're given a 2d point and a radius.

The 2d point is easy to calculate from a 3d point but getting the radius of a 3d sphere projected into 2d space... seems extremely complicated.  How can I achieve this kind of outwards-push effect in a 3d space?


texts: Revenue model for an open-source multiplayer game

texts:
I've had an idea for a multiplayer game, and ideally, I'd absolutely love for it to be open source.

However, I also want to make a profit from it so I can make more games and maybe even have a dev team.

Is it possible to keep it open-source and generate revenue?

One idea I've had is to charge for online multiplayer services, but then users could easily circumvent that by patching in their own servers.

Is there a revenue model that can work for this kind of game project?


texts: Not getting desired results with SSAO implementation

texts:
After having implemented deferred rendering, I tried my luck with a SSAO implementation using this Tutorial. Unfortunately, I'm not getting anything that looks like SSAO, you can see my result below.

You can see there is some weird pattern forming and there is no occlusion shading where there needs to be (i.e. in between the objects and on the ground).  The shaders I implemented follow:

#VS
#version 330 core

uniform mat4 invProjMatrix;

layout(location = 0) in vec3 in_Position;
layout(location = 2) in vec2 in_TexCoord;

noperspective out vec2 pass_TexCoord;
smooth out vec3 viewRay;

void main(void){
    pass_TexCoord = in_TexCoord;
    viewRay = (invProjMatrix * vec4(in_Position, 1.0)).xyz;
    gl_Position = vec4(in_Position, 1.0);
}

#FS
#version 330 core

uniform sampler2D DepthMap;
uniform sampler2D NormalMap;
uniform sampler2D noise;

uniform vec2 projAB;
uniform ivec3 noiseScale_kernelSize;
uniform vec3 kernel[16];
uniform float RADIUS;
uniform mat4 projectionMatrix;

noperspective in vec2 pass_TexCoord;
smooth in vec3 viewRay;

layout(location = 0) out float out_AO;

vec3 CalcPosition(void){
    float depth = texture(DepthMap, pass_TexCoord).r;
    float linearDepth = projAB.y / (depth - projAB.x);
    vec3 ray = normalize(viewRay);
    ray = ray / ray.z;
    return linearDepth * ray;
}

mat3 CalcRMatrix(vec3 normal, vec2 texcoord){
    ivec2 noiseScale = noiseScale_kernelSize.xy;
    vec3 rvec = texture(noise, texcoord * noiseScale).xyz;
    vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
    vec3 bitangent = cross(normal, tangent);

    return mat3(tangent, bitangent, normal);
}

void main(void){

    vec2 TexCoord = pass_TexCoord;
    vec3 Position = CalcPosition();
    vec3 Normal = normalize(texture(NormalMap, TexCoord).xyz);

    mat3 RotationMatrix = CalcRMatrix(Normal, TexCoord);

    int kernelSize = noiseScale_kernelSize.z;

    float occlusion = 0.0;

    for(int i = 0; i &lt kernelSize; i++){
        // Get sample position
        vec3 sample = RotationMatrix * kernel[i];
        sample = sample * RADIUS + Position;
        // Project and bias sample position to get its texture coordinates
        vec4 offset = projectionMatrix * vec4(sample, 1.0);
        offset.xy /= offset.w;
        offset.xy = offset.xy * 0.5 + 0.5;
        // Get sample depth
        float sample_depth = texture(DepthMap, offset.xy).r;
        float linearDepth = projAB.y / (sample_depth - projAB.x);
        if(abs(Position.z - linearDepth ) &lt RADIUS){
            occlusion += (linearDepth &lt= sample.z) ? 1.0 : 0.0;
        }
    }
    out_AO = 1.0 - (occlusion / kernelSize);
}

I draw a full screen quad and pass Depth and Normal textures. Normals are in RGBA16F with the alpha channel reserved for the AO factor in the blur pass. I store depth in a non linear Depth buffer (32F) and recover the linear depth using:

float linearDepth = projAB.y / (depth - projAB.x);

where projAB.y is calculated as:

and projAB.x as:

These are derived from the glm::perspective(gluperspective) matrix. z_n and z_f are the near and far clip distance.

As described in the link I posted on the top, the method creates samples in a hemisphere with higher distribution close to the center. It then uses random vectors from a texture to rotate the hemisphere randomly around the Z direction and finally orients it along the normal at the given pixel. Since the result is noisy, a blur pass follows the SSAO pass.

Anyway, my position reconstruction doesn't seem to be wrong since I also tried doing the same but with the position passed from a texture instead of being reconstructed.

I also tried playing with the Radius, noise texture size and number of samples and with different kinds of texture formats, with no luck. For some reason when changing the Radius, nothing changes.

Does anyone have any suggestions? What could be going wrong?


texts: Why am I getting white lines in my tiled map when my character moves?

texts:
I followed the tutorial here -

http://mainroach.blogspot.com/2013/02/fast-html5-canvas-rendering-tiled-maps.html

I can't really figure out why it's happening. At certain times the map looks fine and then when I move my character the map starts to look like this -


texts: Process for developing psd images into animation

texts:
I wrote a kids' picture book that I want to make into an iPad app and iPhone app.

(More of a story than a game, but same principles, I guess.)

Here's a sample page: https://img.skitch.com/20120108-bqusir4xt3hhxx5fufhh7pw4wy.jpg

(There are words on each page -- I've just scrubbed them out on the image for this example.)

All the images are in Photoshop.

I want to make an app of the book for iPads and other tablets.

For the app, I'd like to add a little animation on each page. Things like fish changing their expressions. Some interaction. Fish swimming on some pages, and other stuff.

I want to know who I should recruit to do the animation:

The illustrator who did the original images normally doesn't do animation.

Since that illustrator doesn't normally do animation, I guess I need to get an animator on board for the project -- what skills am I looking for in that person?

(Obviously they need to know how to make an animation, but what technology etc will they need to know?)

To draw the different frames for the animation, would I need to employ the same illustrator who did the original images, or would a good illustrator be able to do that, based on the images that already exist?

(The illustrator who did the original images is available, but I'd need to wait a while for her to be able to fit the job in.)

The images don't exist as vector files -- they are Photoshop bitmap. Is this an issue?

Thanks, Richard


texts: How to create game database editor interface like Age of Empires' AGE

texts:
Age of Empires had this powerful AGE (Advanced Genie Editor) tool to let players mod the game data with ease. You could see all the game's databases through this tool and play with them to make your own mods in a pretty straightforward way, which I suppose was also used by the devs themselves to author their data.

I was wondering how can I implement a similar editing interface for my game database?

Are there tricks like this that Godot, Unity and Unreal users use to author their data? I feel like I missed something because no popular engine seem to support what I'm looking for out of the box.

If I can't do it in-engine, how should I go to make such a tool myself?


texts: Cocos2d When The Loading Screen Scene is loading music

texts:
When the loading screen loads objects like music cutscenes, the idea is to preload the objects, so... what should happen next? Do I transfer the objects to the next scene? or these special objects, media objects or even just images of the sprites, do they have to be part of a Singleton? According to my logic, singleton is a simple solution, that can I use whatever was preloaded in the loading screen to take to the game. The only drawback is that I have to keep management of these objects to unload them when out of the game scene.(its just an example, but its really close to what my game is doing).

The thing is, i believe there is a more elegant solution to this problem. Anyone has any suggestions? or tell me if my method is wrong?