texts:
It looks like that sampling the same exact color data from different areas of a texture atlas results in different vec4 in the GLSL fragment shader.

In other words, texture2D is directly dependent of the specified texture coordinates, and not only transitively because of the color of the texel at those coordinates.

To say that with an example, I am getting the impression that sampling a red pixel surrounded by blue pixels from, say, (0.1, 0.2) may give a different result than sampling the same shade of red surrounded by the same shade of blue at, say, (0.7, 0.3).

Is this non-deterministic behavior that I am observing likely to be real?

Additional details

I have a atlas that we use to texture multiple screen-aligned quads. Each vertex has a xy position and uv texture coordinates. The allotted rectangles in the atlas do not overlap; furthermore, a 2 pixel margin exists between adjacent rectangles. We are using linear filtering and no mipmapping.

The atlas is populated dynamically using sprites downloaded from the web. Two different runs of the program may have the atlas populated in different orders, even if user input is exactly the same, due to the fact that some HTTP requests may complete before others.

So now imagine that on a run we have a Princess Peach sprite in the middle of the screen; the texture is coming from the upper left corner of the atlas, because Princess Peach was the first sprite added to the scene.

In another run, there have been a few sprites loaded but now their quads are not on the screen and again we have Princess Peach in the middle, in the same exact position as the first run. But this time the texture is coming from a different region of the atlas.

Problem: rendered images are not the same. The differences are imperceptible and usually consist of only a few pixels near the edges of the rendered sprites. The differences are detected by a screenshot testing framework. Where is the source of randomness?

Even more details

It's a WebGL project.
It happens on both GeForce and Quadro cards.
Using nearest neighbor sampling leads to more stable (and ugly) renderings but it does not fully eliminate the problem.
Enforcing a strict order when copying the sprites to the atlas fully solves the problem, but it is not an acceptable solution.
I inspected the GL state using an inspector and I found two frames that should have been the same in two different runs of the program; the state is the same in both cases, the only difference being a different arrangement of sprites in the atlas, and consequently different texture coordinates in the array buffer.
I know that I could test using some sort of fuzzy/thresholded comparison but first I would like to rule out bugs on my side.


texts: Clear reference implementations of MLAA?

texts:
Does anyone know of a clearly written reference implementation of morphological antialiasing (MLAA)?

Intel provide a paper and reference implementation at the following address, but I find the code very opaque.

http://visual-computing.intel-research.net/publications/publications.htm


texts: How do I find an optimal FPS for best user experience while preserving battery life?

texts:
I'm developing an Android game. The "graphics" I'm using need little CPU/GPU, so they run with high FPS. Because saving energy is important on Android devices, I want to limit frame-rate (if deltaTime < limitDeltaTime -> Thread.sleep(...) ).

How high should the frame-rate be to get an optimal balance between saving resources and a "fluid" gameplay experience. At which point is the user experience optimal or no longer improving?


texts: How can I make only the hit brick disappear upon collision with the ball in breakout?

texts:
I want to make Breakout, but I am having problems destroying the bricks upon collision with the ball, all the bricks disappear upon collision, however, I only want the hit brick to disappear, how can I achieve that? (I am using allegro and C++)
The Bricks class:-

class Bricks{
public:
int x;
int y;
bool isDestroyed;
ALLEGRO_BITMAP *brick;
}Brickss[40];

The draw function:-

void draw(){
al_draw_bitmap(background, 0, 0, 0);
al_draw_bitmap(paddle, paddleXPos, paddleYPos, 0);
al_draw_bitmap(ball, ballXPos, ballYPos, 0);
for (int drawBricks = 0; drawBricks < 8; drawBricks++){
    for (Brickss[drawBricks].x = 0; Brickss[drawBricks].x < 1000; Brickss[drawBricks].x += 120){
        Brickss[drawBricks].y = 0;

        if (Brickss[drawBricks].isDestroyed == false){
            al_draw_bitmap(Brickss[drawBricks].brick, Brickss[drawBricks].x, Brickss[drawBricks].y, 0);

        }
    }

    }

al_flip_display();

}

The main function:-

int main(){
//initialize all what we need in allegro and load all the pictures(background,ball,paddle,bricks)
init();
loadBitmaps();
while (!done){
    al_clear_to_color(al_map_rgb(255, 255, 0));

    ALLEGRO_EVENT ev;
    al_wait_for_event(eventqueue, &ev);
    al_start_timer(timer);
    //motion of the ball
    if (ev.type == ALLEGRO_EVENT_TIMER){
        moveBall();
    }
    //motion of the player
    if (ev.keyboard.keycode == ALLEGRO_KEY_LEFT){
        paddleXPos -= movePaddleX;
    }
    if (ev.keyboard.keycode == ALLEGRO_KEY_RIGHT){
        paddleXPos += movePaddleX;
    }
    //bounce back if the ball hits the paddle
    if (intersects(ball, paddle, ballXPos, ballYPos, paddleXPos, paddleYPos)){
        moveBallX *= -1;
        moveBallY *= -1;
    }
    for (int drawBricks = 0; drawBricks < 8; drawBricks++){
        for (Brickss[drawBricks].x = 0; Brickss[drawBricks].x < 1000; Brickss[drawBricks].x += 120){
            Brickss[drawBricks].y = 0;

            if (intersects(ball, Brickss[drawBricks].brick, ballXPos, ballYPos, Brickss[drawBricks].x, Brickss[drawBricks].y)){

                Brickss[drawBricks].isDestroyed = true;

            }
        }
    }
        //draw everything to the backbuffer
        al_set_target_backbuffer(display);
        draw();
    }
    al_flip_display();
    al_rest(10);

}


texts: Removing ads but maintaining opt-in video ads

texts:
I have a game for iOS that will show advertisements.
One form of advertisement offered is a rewarded video (a video that the user can watch by choice). This is actually an important aspect of the game because watching these videos allows the user to continue playing after running out of a certain resource (balls, in this case).
Now, the user can remove the advertisements via In App Purchase.
Question: Is there anything wrong with keeping the rewarded videos as an option for the user, even though they paid to remove ads? If I disallow the rewarded videos, the user will lose a really useful feature of the game, but I'm worried about initializing the advertisement SDK and therefore tracking users who probably think they've disabled any tracking for advertisements.
Thank you for your thoughts!


texts:
Is there a way to scale the bodies made from vertexes (like a guitar), i was trying to multiply each vertex point by the scale value but c++ mark an assertion failed, is there a mehtod to do this?

I have done it, but i want to make a mirror body, but i cant do it :/ just multplying it by -1 or 1 it doesnt run :/


texts: FPS issue between computers results in slow down of animations and moving

texts:
I have been developing my game on two computers. I recently got a new computer and have noticed an issue that seems to be happening in my game.

When computer 1 runs the game at 60 FPS everything seems to run fine, all the timings are correct and everything runs smoothly.

When computer 2 runs the game at 60 FPS everything seems to slow down, everything happens properly (all the timings are correct) but it's as if the update is not being called at 60 FPS. If I "unlock" the frame rate and let it go to >3000 fps then it runs fine, but not when it's at the expected 60 FPS. A frame counter in code seems to tell me the FPS is 59.

I'm not sure if this is relevant but I usually use something like this to perform updates between moving or animations, etc:

 public bool ShouldUpdate(GameTime gameTime)
 {
     if (this.Disable)
         return false;

     float dpf = this.DelayPerFrame; // example value: 60f
     float tpf = 1.0f / dpf;

     this.totalElapsedTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

     if (this.totalElapsedTime >= tpf)
     {
         this.totalElapsedTime = 0f;

         return true;
     }

     return false;
 }

What kind of things can be causing this? I'm more than happy to add any additional information.

I guess my question really comes down to, how do I ensure that all updates and timings happen the same across computers?


texts: Making DirectInput and XInput work together

texts:
I have working wrappers for Xinput and DirectInput in my game, but I had problems with xbox controllers, because they are also recognized as generic controllers by directinput.

I have found out that Microsoft recommends to solve this problem like described on this MSDN page (See the IsXInputDevice function in the code sample).

I implemented the suggested function, but sadly it is very slow and I found out that the following call takes about half a minute to finish on my computer:

pIWbemServices->CreateInstanceEnum(bstrClassName, 0, NULL, &pEnumDevices);

Could anyone solve this problem and if yes, how? I imagine many games use this method to select the correct input method for gamepads, but the problem is not common at all.

For the time being, I began writing a wrapper for raw input but I'd be happy if this also got solved.


texts: libgdx setOrigin and setPosition not working as expected?

texts:
I create a camera:

camera = new OrthographicCamera(5.0f, 5.0f * h/w);

Create a sprite:

ballTexture = new Texture(Gdx.files.internal("data/ball.png"));
ballTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion region = new TextureRegion(ballTexture, 0, 0, ballTexture.getWidth(), ballTexture.getHeight());
ball = new Sprite(region);

Set the origin, size, and position:

ball.setOrigin(ball.getWidth()/2,ball.getHeight()/2);
ball.setSize(0.5f, 0.5f * ball.getHeight()/ball.getWidth());
ball.setPosition(0.0f, 0.0f);

Then render it:

batch.setProjectionMatrix(camera.combined);
batch.begin();
ball.draw(batch);
batch.end();

But when I render it, the bottom left of my ball sprite is at (0, 0), not the center of it, as I would expect it to be because I set the origin to the center of the sprite. What am I missing?


texts:
I would like to create a game similar to powder game.

I've got a 2d array that stores different types of powder such as sand, water, gas, and fire. I've managed to get these to all move around successfully.

I would now like the powders to react to wind. For example if there is fire it should push air upwards. If the air is moving upwards it will move other bits of powder around.

The way I've been trying is to have two more 2d byte arrays. One for the wind x direction and another for the wind y direction. The fire will then add an amount to the cells and each update will add the wind x and y to the piece of powder that is on that cell. This almost works but pushes the powder much to fast.

The difficulty in doing this is that the powder is on a grid while the wind could be going a variety of directions.

What is the most efficient way of doing this?


texts:
Still a Beginner at Unity 5 and this time I am trying to make a Spring.

The spring would act as you'd expect. Something comes in with a direction and force, so you bounce it the opposite direction of the way it came in. Something like this:

But for some reason my player object doesn't interact with my Spring. It goes right through it as if they are on separate layers.

As you see above it falls right through. Now here is my setup:

Finally the Spring Script:

using UnityEngine;
using System.Collections;

public class BounceOnContact : MonoBehaviour
{
    void OnCollisionEnter2D(Collision2D collisionInfo)
    {
        Rigidbody2D rBody = collisionInfo.collider.GetComponent<Rigidbody2D>();
        Vector2 vel = rBody.velocity;
        float mag = vel.magnitude;
        rBody.AddForce(Vector2.Reflect(vel, collisionInfo.contacts[0].normal) * mag, ForceMode2D.Impulse);
    }
}

I'm not really sure what I'm missing. The player object should hit my spring right?


texts: Exporting .FBX model into XNA - unorthogonal bones

texts:
I create a butterfly model in 3ds max with some basic animation, however trying to export it to .FBX format I get the following exception.. any idea how i can transform the wings to be orthogonal..

One or more objects in the scene has local axes that are not perpendicular to each other (non-orthogonal).
The FBX plug-in only supports orthogonal (or perpendicular) axes and will not correctly import or export any transformations that involve non-perpendicular local axes.
This can create an inaccurate appearance with the affected objects:
    -Right.Wing

I have attached a picture for reference . . .


texts: Rectangles render with gaps in between them (Box2D)

texts:
Right now I create my boxes where 1 meter is 85 pixels. Gravity is 10.  And

                        fixtureDef.restitution = 0.1f;
            fixtureDef.friction = 0.5f;
            fixtureDef.density = 1.0f;

The problem I'm having is illustrated in the image I have provided:

As you can see, there is a small gap between many, but not all the crates. What could cause this?

Thanks


texts: Animation with pivot-modification in Mecanim

texts:
Assume I have two animation cycles:

Walking
Crouching

Both assume that the model's pivot is on the same level as the model's feet.

Now I also have two animated transitions:

Get on all fours while walking
Climb onto a (table)

The first is not too complex. The model walks upright, then gets down on all fours (animation 1) and crouches. Pivot remains on the same level, all fine.

What I want:

However, I can't get my head around the second transition. I want the model to

walk up to the table (pivot on ground level)
climb onto the table (animation 2) (pivot..?)
crouch on the table (pivot on table level, 1 m above ground)

What I have:

The climbing animation (2) assumes pivot to remain on ground level and simply animates the model's climbing up. I built a StateMachineBehaviour which raises the model to the table level as soon as the climbing animation is complete. From then on the pivot is on table level and the crouching can continue.

This seems to work fine in a standalone application, however, in multiplayer, where the models' transform and animator state are not necessarily synchronized in the same frame, this prooves problematic. One can clearly see the model jump when the change in the model's position arrives one frame earlier than the switch from climbing to crouching animation.

What I tried:

I thought it might be a better idea to have the pivot move gradually from ground level to table level over the duration of the climbing animation (2), instead of having one instant jump at the end. This way network synchronization would be much more robust because of the relatively small change per frame. Also this approach would much closer resemble the actual thing that's happening in the real world, which is generally a good thing. I tried offsetting the root transformation of the animation clip, and accomodate the modification by adding the negative offset to the root bones. This however did not work, as there seems to be no animatable translations in Mecanim animation clips. So im stuck at this approach.

Question:

Is there a better way? A simpler way? How are you guys tackling this?


texts:
I have 5 cubes and all 5 cubes have an audiosource. When my player jumps into those cubes, the audiosource is playing just once. It was working. But then, I decided to re-organize my hierarchy and audiosource didn’t work well.
When I jump to first cube, the audio plays but then if I try to jump to the other cubes, the audio does not play. I have a prefab cube and all 5 cubes are the created from that prefab. It gives Can not play a disabled audio source and I don’t know why?  I haven’t changed about coding part.
This is my first cube component :
The other 4 cubes (actually they all the same as with the first cube):

Coding Part :
//Eğer karakter ses efekti tamamlanmadan diğer paddle'a atlarsa paddle ses çıkarmıyor. Bunu düzelt

[SerializeField] AudioSource clickSound;

bool landedorNot = false;

void Start()
{
}

private void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.name == "Ship New Pos" && landedorNot == false )
    {
        landedorNot = true;

        if (!clickSound.isPlaying)
        {
            clickSound.Play(); // this is where the error occurs according to Unity
        }
    }
}


texts: Is there a reason online video games don't have "benches"?

texts:
In many physical team sports, in addition to the players deployed on the field, there are also players on the bench who the coach can sub in when the players get tired or run into unforseen circumstances. This is more common at low levels of play.
However, in online e-sports (e.g. Overwatch, League of Legends, Counter Strike), this is almost universally absent, with everyone who queues expected to play the entire duration of the game. This is not always possible, nor, in the case of solo queue, always desired. If it does exist at all, it involves players joining games in progress, which means that the subbing team is left with no one until a replacement shows up, and players being subjected to new skill ratings that they weren't originally matched up to. I have never seen the concept of one or more bench players being available from the start, known to both teams at the start, and available to sub in as needed, akin to how a physical sport would operate.
Why is this? Are there cons to such a system that would cause it to fail or cause more problems than it solves? Has this been tried before somewhere?


texts:
I'm making a 2D game in XNA/Monogame and I'm using Stardew Valley as a visual template (it's got the SNES style I'm going for).  I'm having trouble mimicking the feature to change screen resolution and even get the game to draw as I'd like it.

As background, Stardew map tiles are 16x16 pixels.  On screen the map is about 30 tiles wide by 16 tall.  Naively this would make the screen 480x270 pixels, which is way too small on my 1920x1080 monitor.  I'd like the game window to match my screen, but to get the game objects to scale properly.

Is there a proper way to change the screen resolution in XNA?  Maybe some scaling factor in the SpriteBatch object that I'm not aware of?


texts: Handling of Slopes for a Character Controller

texts:
I recently moved from Bullet to PhysX to see if it would be a better solution for my game engine, and so far it is. The only problem that I'm having, which is part of the reason that I switched is with the character controller. The build in one is pretty good, but I've run into an issue when I walk down a slope (although up is fine). Because the player walks faster than gravity pulls him down (I set it to 0 when he is on the ground), he detaches from the slope, which obviously is not desirable.

I've considered and tested several ways to fix this. One idea that I had was to check if there was ground below the character once he moved in the xz-direction, with a distance less than or equal to to the magnitude of that vector because I decided that a 45º slope was what the character could not walk up. That had a huge amount of problems and resulted in a lot of teleporting.

Then I tried to make it so when the player was on the ground that a really high gravity would be applied to keep him on the slope. This also didn't work because if the character was on the ground and then moved over a cliff, he was on the ground before he walked over the cliff he would be teleported down.

I'm really not sure how to progress here because logically the problem has stumped me. I took a look at some of the behavior of the Unreal character and it doesn't seem to suffer from any of these problems and it uses PhysX, so obviously they found a solution.

If anyone has any ideas, I would appreciate it.

Thanks


texts: Locking object access with Allegro's threading API

texts:
If I have a data structure for the Allegro threading API as shown in the example here:

https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Threads

And I lock the mutex, is there a way to have one of the members of that data structure be a reference to an entire object that has read/write access to its public member functions locked?

That is to say, if I have a member variable which is a reference to a non POD-type object in that data structure, will locking the mutex restrict access to all of the object's members in another thread, or will it simply lock the reference itself from being modified?


texts:
I'm looking for a simple algorithm for LOD, for changing geometry vertexes and decreasing frame time. I've created an octree, but now I want model or terrain vertex modify algorithm, not for increase (looking on tessellation later) but for decrease.

I want something like this:

Questions:

Can the same algorithm apply to both model and terrain correctly?
Do indexes need to be modified?
Must I use octree or simple check distance between camera and object for desired effect?
Is a new value of indexcount for the DrawIndexed function needed?

Code:

     //m_LOD == 10 in the beginning
     //m_RawVerts - array of 3d Vector filled with values from vertex buffer.

     void DecreaseLOD()
     {
         m_LOD--;
         if(m_LOD<1)m_LOD=1;
         RebuildGeometry();
     }

     void IncreaseLOD()
     {
         m_LOD++;
         if(m_LOD>10)m_LOD=10;
         RebuildGeometry();
     }

     void RebuildGeometry()
     {
         void* vertexRawData = new byte[m_VertexBufferSize];
         void* indexRawData = new DWORD[m_IndexCount];
         auto context = mp_D3D->mp_Context;

         D3D11_MAPPED_SUBRESOURCE data;
         ZeroMemory(&data,sizeof(D3D11_MAPPED_SUBRESOURCE));

         context->Map(mp_VertexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(vertexRawData,data.pData,m_VertexBufferSize);
         context->Unmap(mp_VertexBuffer->mp_buffer,0);

         context->Map(mp_IndexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(indexRawData,data.pData,m_IndexBufferSize);
         context->Unmap(mp_IndexBuffer->mp_buffer,0);

         DWORD* dwI = (DWORD*)indexRawData;

         int sz = (m_VertexStride/sizeof(float));//size of vertex element

         //algorithm must be here.
         std::vector<Vector3d> vertices;
         int i = 0;
         for(int j = 0; j < m_VertexCount; j++)
         {
             float x1 = (((float*)vertexRawData)[0+i]);
             float y1 = (((float*)vertexRawData)[1+i]);
             float z1 = (((float*)vertexRawData)[2+i]);
             Vector3d lv = Vector3d(x1,y1,z1);

             //my useless attempts
             if(j+m_LOD+1<m_RawVerts.size())
             {
                 float v1 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD]]);
                 float v2 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD+1]]);

                 if(v1>v2)
                     lv = m_RawVerts[dwI[j+1]];
                 else
                     if(v2<v1)
                         lv = m_RawVerts[dwI[j+2]];
             }

             (((float*)vertexRawData)[0+i]) = lv.x;
             (((float*)vertexRawData)[1+i]) = lv.y;
             (((float*)vertexRawData)[2+i]) = lv.z;

             i+=sz;//pass others vertex format values without change
         }

         for(int j = 0; j < m_IndexCount; j++)
         {
             //indices ?
         }

         //set vertexes to device
         UpdateVertexes(vertexRawData,mp_VertexBuffer->getSize());

         delete[] vertexRawData;
         delete[] indexRawData;
     }


texts: How much is atomicAdd slower than an atomic counter?

texts:
I am considering replacing an atomic counter in my shader code with a SSBO an atomicAdd operation. What I need to know is the difference in performance of these two. I know the atomic counter executes in roughly 3 clock cycles on my Geforce 840m.
The reason behind this is that I would like to add an arbitrary number to the counter rather than just increment by 1.


texts: Should static tiles and dynamic tiles share the same parent class?

texts:
I want to make an abstract Tile class for all of the tiles in a platformer game - walls, platforms, floor traps, everything. This parent class has basic things every tile will have, such as width and height, position, and boundbox, as well as getters for all of these things. I want to make these attributes constants, because those things typically shouldn't be changing - a wall shouldn't have its width and height changed, for instance. However, in some special cases, those attributes may indeed change - a special platform may change its height when the player jumps on it, or another special platform may disappear after 1 second after the player jumps on it, for instance.

This presents a problem, because for the static tiles, non-constant attributes in the Tile class is bad practice, but for dynamic tiles, constant attributes will prevent them from being dynamic. Is the best method, then, to create two different parent classes, which are the same, aside from one with constant attributes and one with non-constant? Is there a special name for dynamic tiles (I've heard "entity" thrown around, but I really don't know)?


texts: Calculate angles between two other angles

texts: I am trying to implement a FOV for my light casting algorithm. In the diagram below each white line represents a ray cast from a std::vector<float> of normalized radians. How can I only include angles which lie between the two green lines? (The FOV min and max).


texts:
i am android programmer and i want control button input in android
for example i made a game that when you press back button in android mobile
nothing happens but i want quite from game.

This is how you can use the android back button in Unity games.

In C#

void Update()
{
   if (Application.platform == RuntimePlatform.Android)
   {
    if (Input.GetKeyDown(KeyCode.Escape))
        Application.Quit();
   }
}

or in JS

function Update()
{
   if (Application.platform == RuntimePlatform.Android)
   {
    if (Input.GetKeyDown(KeyCode.Escape))
        Application.Quit();
   }
}

but how i can contorl other buttons


texts: KinematicBody returns null to try get collided Rigidbody

texts:
Player is a KinematicBody and enemy is a Rigidbody. I'm using move_and_slide() to move player. When they collided, each both push them opposite direction, so it seems like physics stuffs working, however when I try to get collided object, it always returns null.

Using move_and_collide() returns null, and try this way also returns null:

for index in get_slide_count():
    var collision = get_slide_collision(index)
    print(collision)

However when I changed the type of enemy to StaticBody, now it gives me enemy. But I don't want to use StaticBody to enemy, they needed to move! Why get collided is always null even it's collided with Rigidbody?


texts:
DISCLAIMER: I know this question starts to leave development island but it is very game development related and still think this is the best place.

I see many free MMOs/online desktop client games out there. I am baffled at the ability to fund such. I don't mind hosting myself but would at least like to have someone host a matchmaking service. If these indie devs really are pouring money down the server drain then I'm screwed but if some one can "learn me" :) some alternatives I would greatly appreciate it.


texts:
How can I manually set that Unity can read .blend file inside Unity?

I have portable Blender.

When I add blend file in Unity it says: Blender is not found. How to make Unity understand .blend file?


texts: smooth animation following a random path in real time

texts:
So, I'm toying around with an augmented reality game. I'm using computer vision to track a particular object, which works reasonably well. I'm trying to animate something that basically follows that object around on screen.

This has proven pretty hard. The tracked location of the object is very jittery. I've tried to smooth it out by setting a threshold under which we don't bother moving the sprite, but this leads to jumpy animation rather than jittery. I want the sprite to follow the tracked object in close to real time, so aggregating movement over a lot of frames to get smooth results isn't a great option for me.

Are there any techniques I could use in this case that might help smooth things out?


texts: Dealing with collisions across adjacent static bodies

texts:
The Problem:

I have the following setup:

A, B and C are rectangular static bodies in box2d.
p is a circular dynamic body in box2d.

The movement of 'p' is solely controlled by the current gravity force of the world.

When 'p' collides with a static body (A, B or C) I play a bouncy sound. I handle this through a standard ContactListener. No problems there.

The problem arises when 'p' is on 'A' and traveling left towards 'B'. This causes another collision to fire (on 'B') which results in another bouncy sound which is unwanted. If however 'p' was to be traveling right and contacted 'C' I would want the sound to play (given enough velocity, etc).

TL;DR - When sliding across multiple static bodies how do I effectively ignore collisions from a body that is on the same 'line' I'm already on?

What I've Tried:

I've tried numerous different approaches such as on collision tracking that normal as my 'ground' normal and ignoring collisions from the same normal. This works until I do something like make contact with 'C' which then becomes my new 'ground' normal. But having never lost contact with 'A' if I go back towards 'B' I will trigger another collision and we're back to square one.

The Plea:

Looking for code-based solutions or ideas if at all possible. I've considered trying something like a chain shape around my level's collidable areas, but with certain parts of my world being dynamic I don't feel like that's an adequate solution.

Thanks!


texts: What is the necessary know-how to write an animation library (IK & FK)?

texts:
I can't find any good library for animation, the ones that I found are just really old and discontinued, but I have noticed that the libraries are relatively small, so I'm thinking about coding one on my own: where should I start? What are the basics for this? There is a book about this?

Some further notes about a good file format for animation are also highly appreciated.

I'm using C++.


texts: 3D Vector "End Point" Calculation for procedural Vector Graphics

texts:
Alright, So I need some help with some Vector Math.

I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees and Plants. L-Systems, are drawn by using Turtle Graphics, which is a form of Vector graphics.

I first created a system to draw in 2D Graphics, which works perfectly fine. But now I want to make a 3D equivalent, and I’ve run into an issue.

For my 2D Version, I created a Method for quickly determining the “End Point” of a Vector-like movement. Given a starting point (X, Y), a direction (between 0 and 360 degrees), and a distance, the end point is calculated by these formulas:

newX = startX + distance * Sin((PI * direction) / 180)

newY = startY + distance * Cos((PI * direction) / 180)

Now I need something Similarly Equivalent for performing this Calculation in 3D, But I haven’t been able to Google anything that could show me how to do this.

I'm flexible enough to get whatever required information is needed for this method calculation, in any reasonable form (Vector3, Quaternion, ect).

To summarize: Given a starting point/vector position in 3D space (X, Y, Z), a Direction in 3D space (Vector3, Quaternion, ect), and a Distance, I need to find the “End Point” in 3D Space.

Thank you for your time and help.


texts: How to determine range of possible movement in turn-based, distance-based strategy game?

texts:
I'm creating a 2-dimensional, turn-based strategy game using c++ and SFML-2.0. Movement is distance-based rather than grid-based, with several different triangle-shaped pieces that, on a given turn, each may either rotate in place or move forward.

Movement will work in such a way that the player selects a location for the piece to move to, which generates a potential path for the piece to take.  Once the player confirms his or her decision, the piece will move along that path to the desired location.  Paths are limited by two factors: distance, how far a piece is able to go, taking into accounts any turns (so if there is a curve, it will be the length along the curve, and not directly from point to point); and steering angle, how far the piece can rotate at any (and up to every) point while moving (for example, from -30 to 30 degrees).

My question is, how should I go about determining the range of potential locations that the player can select to have the piece move to?

I'm not entirely sure what equations and/or algorithm to use here.  My original plan was extremely over-complicated, to the point where it was near impossible to implement, let alone explain, and I am at this point totally lost with the project stalled.

How can I determine the range a unit can move, taking into account its turning radius?

For example, in the below image. The red, blue and green lines would all be the same length. The purple circle denotes the movement range the unit can move. (The shape is probably inaccurate and the lines probably aren't actually the same length, but you get the idea)


texts: VBO with texture index buffer different than vertex index buffer

texts:
I am trying to write my own OBJ importer and renderer in OpenGL (yes, I know, reinventing the wheel) and I found a problem that I don't knwo how to handle.

In an OBJ file faces are defined by a list of indices that refers to the vertices IDs that belongs to that face (and the same for texture coordinates IDs), an example of a face could be:

  f 2411/905 2414/906 2913/1463

which would mean that this face is created by vertices 2411, 2414, 3913 and texture coordinates IDs 905, 906, 1463. And this leads to different index buffers, if I am not mistaken...

Now the question is, having both a buffer of vertices and a buffer of texture coordinates, how can I use both "at the same time", if I am only able to bing one index buffer and the indices to be used for a particular face are different for vertices and texture coordinates? Is there any trick to bind two index buffers, one for vertices and another one for texture coordinates?

And finally, just to give some code of what I've tried and that obviously doesn't work because I am binding two different GL_ELEMENT_ARRAY_BUFFER_ARB before drawing..., so it ends up with random texture coodinates.

// TEXTURE VBO
glBindBufferARB(GL_ARRAY_BUFFER_ARB, texCoordBuffer);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, texIndicesBuffer);
glIndexPointer(GL_INT, 0, 0);

// GEOMETRY VBO
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffer);
glVertexPointer(3, GL_FLOAT, 0, 0);
glEnableClientState(GL_VERTEX_ARRAY);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, normalBuffer);
glNormalPointer(GL_FLOAT, 0, 0);
glEnableClientState(GL_NORMAL_ARRAY);

glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indicesBuffer);
glIndexPointer(GL_INT, 0, 0);

// Bind texture and draw...


texts: Serverside libs/examples for html5 WebSocket in .net?

texts: Hey guys, I wanted to know what libraries or examples exist for WebSockets in .NET


texts:
I'm working on adding bullets to my game.  Right now I can shoot bullets in the direction that I would like from a ship by getting the ship's angle:

int speed = 5;
int dx = -(cos(degreesToRadians(ship.angle)) * speed); // rate of change in the x direction
int dy = -(sin(degreesToRadians(ship.angle)) * speed); // rate of change in the y direction

bulletPosition.addX(dx); // addX(dx) is simply bulletPosition.x += dx
bulletPosition.addY(dy);

The ship is pretty much the exact same thing, except I use the += operator:

int dx += -(cos(degreesToRadians(angle)) * 0.15)
int dy += -(sin(degreesToRadians(angle)) * 0.15);

shipPosition.addX(dx);
shipPosition.addY(dy);

I would like to be able to add the ship's velocity to the bullet's velocity, but I'm a little confused as to how should get the speed from the ship's vector.  I thought that adding the ship's dx to the bullet's dx like int dx = -(cos(degreesToRadians(ship.angle)) * speed * dx) would work because I'm adding the rate of change of the ship to the rate of change of the bullet, but that doesn't work.  So here's the final question: How can I get the speed of my ship and apply it to my bullet's speed?

Thanks in advance for all help :)


texts:
I'm working on a UI-heavy game and I'd like to add sound effects for when the player mouses over a UI button (using TMP, if that matters). I've tried OnMouseOver and its siblings OnMouseEnter and OnMouseStay, I've tried with and without 2D Box Colliders, but so far nothing I've tried seems to register that the mouse is over the button: i.e. nothing happens. If a collision or Raycast hit were registered, all that I'm asking right now is for it to run the line Debug.Log("Collision detected");
I know that Unity is able to register hits on the UI element I'm testing on, because mousing over it engages the Sprite Swap function that's part of the Button component, which it would not do if it were not accepting Raycast hits.
I'm sure there's some very simple solution to this, like a check-box I haven't ticked, but I could really use some help here.
Many thanks!


texts: How to solve "server lag" problems that break the game

texts:
How do real-time multiplayer games deal with latency problems (or “server lag”)?

Imagine an online fighting game where 2 players battle head-to-head in real time. When a player performs an action, there'll be a short delay until that player's action appears on the opponent's computer screen. This delay causes many game-breaking problems.

Let's say 2 hypothetical players, Player A and Player B, are fighting against each other right now in the game, and the latency is 1 second. Player A is moving toward Player B, but then Player B places a wall (or something of the like) that stops Player A from moving toward Player B. Player A doesn’t see the wall appear on his/her computer screen until 1 second later, but by then Player A has already moved past where the wall was placed.

In a more game-breaking situation, Player B is just about to kill Player A. Right before that happens, Player A uses a special attack that instantly kills Player B. But on Player B’s computer, Player B kills Player A, because it takes 1 second before Player A’s special attack happens on Player B’s computer. This makes it so both players die even though only Player B was supposed to die.

One solution to deal with the latency issue is to implement an artificial delay so that when there’s a discrepancy, one player’s game is momentarily paused to wait for the other player’s game state to “catch up.” This is not a good solution because it makes the game feel extremely laggy and unresponsive, and it also renders some reactive actions useless (like dodging) because of the artificial delay.

What can be done to fix these latency problems?


texts: What is the state of the art of ray tracing on the GPU?

texts:
I think ray trace rendering had to be done on the CPU for a long time. But since we have compute shaders in OpenGL 4.3 now, it might be possible to move the computations on the GPU and perform passable real time rendering.

What approaches for GPU based ray tracing are there already? Can it compete with rasterization rendering nowadays?


texts:
I am making a breakout clone for mobile and was wanting to make the ball speed to be related to the screen size.  Larger screen would mean faster speed.

Right now I have it set like so:

dirx=math.random(-5,5)*(maxx/320)
diry=math.random(3,7)*(maxy/480)

My reasoning for this is that 320x480 is iPhone resolution so I figured it would be a good base to start at.  For the record, it actually runs pretty well on iPhone setting.

Then for the actual movement I just add dir to the appropriate direction.

ball.x=ball.x+dirx
ball.y=ball.y+diry

The problem is if I change to a device with a larger screen resolution, the ball is crazy fast and is very jumpy.

Is some kind of formula that I can use to multiply to the random that will make the speed appear uniform across devices?


texts: How to write from shader to a texture to a PNG in Unity?

texts:
I want to write the information from my shader into a texture and save it in a png.

I found this:

http://forum-old.unity3d.com/threads/save-texture-generated-by-a-shader.326561/

and this

System.IO.File.WriteAllBytes(Application.dataPath + "/"+"picture5886.png", texture2.EncodeToPNG());    //app path n1!

But currently it seems to be unsolved.

Lets say I do Graphics.Blit(src,temp,mat) into a "tempTexture".
I would have the temp texture then somewhere in my world, right?.
How can I save that into a png?


texts:
I'm developing a multiplayer canvas game based on socket.io and box2d physics engine. Is there a way to limit connections to my socket endpoint and only allow connections from a specific domain?

window.socket = io.connect('http://mysite:8080');

I don't want people to be able to use my end point which is currently possible. They could just use the above code and then "manipulate" the clients logic based on the emits from the servers response.


texts: Unable to control trigger events for car animation collsion control

texts:
I have different car animation running on the road which have imported from max. I want to make such an intelligent System that if car start to trigger from another car it become stop. So far I have tried this.

Added four collider (as you can see in Fig 1) with tag name car, carBack, carLeft, CarRight

car left/right contains this code. Added this script to car left,right collider that if this collider hit with car object then car become stop.(And on trigger exit it resume)

 void OnTriggerEnter(Collider c)
    {
        if (c.tag == "Car")
        {
            Debug.Log("collided with : carsideTriggerScript :" + c.transform + " - object Name to stop : " + gameObject.name);
            c.transform.gameObject.GetComponent<AnimationControlSpeed>().Speed = 0;
            //StartCoroutine(DecreaseSpeedGradually(transform.gameObject.GetComponent<AnimationControlSpeed>()));
        }
    }

    void OnTriggerExit(Collider c)
    {
        if (c.tag == "Car")
        {
            Debug.Log("Exi collided with :  carsideTriggerScript:" + c.transform + " - object Name to resume : " + gameObject.name);
             c.transform.gameObject.GetComponent<AnimationControlSpeed>().Speed = 1;
        }
    }

Added script which check that if car start to collide with carBack collider then stop (And on trigger exit it resume. Same script as above).

But a scenario is creating which you can see in fig 2.

I am enable to handle it. it seems that one car collider hitting  carRightCollider and same thing happen with another car so that both car become stop and unable to move again.
     How can i control it? as same scripts are attached to every gameobject with same OntriggerEnter and logic.


texts: How do I get rid of this coloured border on my sprite?

texts:
I'm working on a 2D game in Unity. My triangle sprites display in-game with a line along one of the transparent sides:

Larger view here.

You might need to zoom somewhat. It's quite obvious on the leftmost triangle.

I'm unsure where this comes from. There is no border in the PNG file. As you can see in the screenshot, the border is also present in the preview.

Where does it come from? How do I get rid of it?


texts: Is it possible to convert vec4 to int in GLSL (using OpenGL ES)

texts: I need GPU to do some computations, and I pass shader an int array using glTexImage2D (internal format is GL_RGBA).  I use texture() to get the data, but it returns a vec4 value.  Is it possible to convert vec4 to int in GLSL?


texts:
Any way to run original Prince of Persia code?
The code is hosted here.

Or if it is out of possible what is the best incarnation of this game ? PC/Amiga or whatever porting ?


texts: Why does my "spawnedEnemies" variable not update when enemies are destroyed?

texts:
I'm creating a shooter game and I'm trying to update the current count of enemies on screen. When the laser hits an enemy, it is supposed to subtract 1 from the "spawnedEnemies" and then destroy the laser. What's happening is that the spawnedEnemies count doesn't update in game, only when the game is over. Then when the game is over, it shows a negative number. When the game starts, there is 0 enemies spawned.

This is my EnemyController class. When the "Enemy" is hit with a laser, it updates the "spawnedEnemies" int in the GameManager class. But it doesn't update it in game, only when the game is over and it shows a negative number. Ex: I spawn 5 enemies, I shoot all 5 of them and it shows -6 in the Inspector.

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

 public class EnemyController : MonoBehaviour
 {
     public GameManager theGM;

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

 private void OnTriggerEnter2D(Collider2D other)
     {
         if (other.tag == "Laser")
         {
             theGM.spawnedEnemies = theGM.spawnedEnemies - 1;
             Destroy(this.gameObject);
         }
     }
 }

This is my GameManager Class:

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

 public class GameManager : MonoBehaviour
 {
     public int maxEnemiesAllowed;
     public int spawnedEnemies;
     public float timeBetweenEnemies;
     public float nextEnemySpawn;

     public GameObject[] enemies;

     // Start is called before the first frame update
     void Start()
     {
         spawnedEnemies = 0;
     }

     // Update is called once per frame
     void Update()
     {
         float spawnPosition = Random.Range(-2.25f, 2.25f);

         if(spawnedEnemies <= maxEnemiesAllowed && Time.time >= nextEnemySpawn)
         {
             Instantiate(enemies[0], new Vector3(spawnPosition, 6f, 0f), Quaternion.identity);
             spawnedEnemies++;
             nextEnemySpawn = Time.time + timeBetweenEnemies;
         }
     }
 }


texts: Transform coordinates in vertex shader or in geometry shader?

texts:
Currently I have a vertex shader which just passes the coordinates to the geometry shader and a geometry shader which does some sort of tessellation. Now I also want to transform my model with a 4x4 matrix before applying the tessellation.

I could apply the transformation either at the end of my vertex shader or in the beginning of my geometry shader.

Does that make any difference? Is there a recommended practice?


texts: How to transfer an object from one state / form to another

texts:
I want to do a similar cooking meal like in the game "Overcooked". Where do you cook a variety of dishes.

I can not grasp the idea of how it is implemented or where to start. You take an object (vegetable), interact with the necessary "changers" (cutting, cooking). At the end of the process - you replace the model and go further?

What do I need to know? What to use? What to google?

I will be glad to any help.


texts:
Hi everyone does 3D racer games use heightmap to build tracks or programmers just use easier solution ? I need to build only track space(road) without fill all hectares with trinagels and more important i need to raise smooth ascents on this tracks

i aksing for some tips not for completle solution of course.


texts:
I'm trying to get some music to play back in stereo in libGDX, but it seems to be blending the left and right channels so much that it sounds like it was mono.

To test this out I made a sound file that is just me saying "left" in the left channel and "right" in the right channel. After playing this through libGDX's music class it has blended the channels to the point where the difference is only slight. This is much more noticeable with stereo music where the difference is smaller to begin with.

Here are the sounds themselves. The first one is the input file as I recorded it, and the second is the output recorded from the game:

http://www.jimmakesgames.com/leftRightInput.wav

http://www.jimmakesgames.com/leftRightOutput.wav

You can hear the difference very clearly with headphones. I've looked high and low and can't find anything about this. The libGDX audio stuff seems to be pretty much a black box. The only reference I found to setting stereo or mono is with the newAudioDevice method which is only for writing PCM data directly.

I'm pretty desperate at this point, so if anyone can offer some assistance it would be greatly appreciated. Thanks.


texts: Issues with importing bezier curve animation (curve does not distort?)

texts:
Hi guys i'm pretty new to unity and having a frustrating issue; I've created a spear gun with an animation using a bezier curve grouped to the main gun shaft and distorted using a bone (bone relative) in blender. It works fine in blender, however when I export it into unity 5, the bezier curve does not distort and simple moves forward and back. I imported the blender model as a blender file.

I have tried pairing the model components in all the ways i can think of to see if that was the problem? I have attached the blender views and animations and what it looks like in Unity.

Is it an issue with unity being unable to animate bezier curve animations or the type of bone pairing i used??

unity animation, see the besiel curve simple moves forward and back instead of bending/distorting to look like a rubber fitted on a real gun!


texts: How could a NPC find items that appear randomly?

texts: My main question is basically: What is the algorithm that CPU players use in smash bros to find items like the smash ball? I am trying to make a small ai character that will "look around" and once an item appears it will find it and walk to it. In all smash bros the cpu players are able to find items on the stage when they appear. How do they do this?


texts: How to create public Arrays of game objects so that they can be assigned through inspector

texts:
I am making a unity2D game. I need to declare public array of gameobjects so that I can assign them colliders, textures through inspector by drag n drop.
Is there any way to do this? I am using c#.

I found but not able to figure this out.Here is one link that is not useful for me please tell why???


texts:
I'm having a really hard time getting the shadows the become transparent.  I've looked online and followed tutorials, but it's not working(See Below).

It may be a little difficult to see so you should look at it in a different window.

How do I add transparency to the shadow(color less saturated), in a way to make the light look like it goes through the crystals?


texts: How should I texture objects in Blender to use in Unity?

texts:
I need to model some things to use in Unity. How should I texture objects (road, tree, etc.) in Blender?
I almost lost all textures when I exported and loaded them into Unity.


texts: Low-level GPU code and Shader Compilation

texts:
Bear with me, because I will raise several questions at once.  I still feel, though, that overall this can be treated as one question that may be answered succinctly.

I recently dove into solidifying my understanding of the assembly language, low-level memory operations, CPU structure, and program optimizations.  This also sparked my interest in how higher-level shading languages, GLSL and HLSL in particular, are compiled and optimized, as well as what formats they are reduced to before machine code is generated (assuming they are not converted directly into machine code).

After a bit of research into this, the best resource I've found is this presentation from ATI about the compilation of and optimizations for HLSL.  I also found sample ARB assembly code.

This sort of addressed my original curiosity, but it raised several other questions.  The assembler code in the ATI presentation seems like it contains instructions specifically targeted for the GPU, but is this merely a hypothetical example created for the purpose of conceptual understanding, or is this code really generated during shader compilation?  If so, is it possible to inspect it, or even write it in place of the higher-level syntax?  My initial searches for an answer to the last question tell me that this may be disallowed, but I have not dug too deep yet.

Also, along the same lines, are GLSL shader programs compiled into ARB assembly code before machine code is generated, and is it possible to write direct ARB assembly?

Lastly, and perhaps what I am most interested in finding out: are there comprehensive resources on shader compilation and low-level GPU code?  I have been unable to find any thus far.

I ask simply because I am curious :)


texts:
I have this screen in the editor made with NGUI and 8 sprites:

But when I build it for android and open the game the same sprites on the screen looks blurry

I don't know what could be causing this, I have all the sprites in Point(no filter) mode, no mip maps and in True Color. Their Max Size is according to each sprite size.

I haven't touched anything strange in the atlas maker(it's only one big atlas), so it should have all default settings. What could possible be the cause of this? I have been searching but I haven't found anyone who had the same problem. Is there a setting I could be missing?


texts: How can I build a data structure that will persist across saves/loads in GameMaker version 8.1 and earlier?

texts:
I wish to build data structures such as trees, linked lists, graphs, stacks, queues, etc. in Game Maker. However, the concept of object in Game Maker Version 8.1 and older does not have a reliable concept of what a pointer is. They shift whenever something is deleted or instantiated, which is obviously bad if everything relies upon a construct of pointers. I think the motivation behind this is to avoid a dangling pointer error, but it makes objects practically useless.

The built in data structures found in the "ds_..." functions do not persist when saving and loading. They are simply unsaved altogether. This is also not very good in the long run as it could complex constructs to fall apart at random.

Therefore, this begs the question of how one can implement data structures in general that don't have this issue?

Due to recent updates in the engine's implementation of pointers in Game Maker Studio, the problem itself no longer exists as pointers do not need to shuffle to prevent dangling pointer exceptions (as was apparently the motivation behind that cough idiotic cough design choice). However, as objects in the language are somewhat bloated this question still serves as a way of asking for a memory-cheap solution to this problem.

Users of the original Game Maker software or people attempting to mod older games which feature code-based modding will still benefit from this post.


texts:
I'm trying to move an object towards the top of the screen while the touch is active.
This is my current code. When I am touching the screen, the object I'm trying to move just keeps it's place (and the gravity seems to be disabled from this point). I'd be glad if someone could help me in this case. Thanks in advance!

public class PlayerScript : MonoBehaviour
{

public Vector2 jumpForce = new Vector2(0, 12);
public int speed = 3;

void Update()
{
    for (int i = 0; i < Input.touchCount; i++) {
                    Touch touch = Input.GetTouch (i);
                    while(touch.phase == TouchPhase.Began) {
                            // Touch are screens location. Convert to world
                                rigidbody2D.velocity = new Vector2(0, speed);
                                rigidbody2D.AddForce(jumpForce);
                    }

            }
     }
 }


texts:
i currently developing a game using the xna API.

now the game i am developing is 2.5d.

by 2.5d i mean the character or object can move left and right and a up and down(not just by jumping) that it would look like there is depth to the level.

try to think something like little fighter 2 where you can also walk up and down.

now i need to develop a gravity system,so far i used the idea that i draw a shadow on the ground of the level,and it follows the object or character and when the character jumps,he moves parabolic like in the real world(using very simple physics).

the gravity system detects landing if the position of it's shadow is the position of the character( or the position of the character is below the position of the shadow). is there a better way to simulate gravity in this 2.5d approach?


texts: How can procedural generation be used to support exploration mechanics?

texts:
It would seem that procedural generation would be a great tool for open adventure games, since it would provide an almost limitless world. However, I notice most successful procedural generation games are of a totally different genre. The only game I can think of that uses procedural generation for exploration specifically is No Man's Sky, but it failed to meet expectations, probably in part because the procedural content, while vast, did not necessarily add as much value to the exploration game mechanics as people thought it would.

From attempts making procedural generation games and from what I see in other games, I see three problems hindering procedural generation in adventure games, and I cannot see any solutions:

Procedural terrain may be straightforward, but procedural storytelling is not. I tried both. A few simple rules can make something that resembles a mountain or a city, but it is hard to make a game around it unless you have some sort of quest. It is hard to design a quest, though, unless you have a map to work with. How can you make a quest to find a place that might not exist?
Procedural terrain provides scale without density. Sure, a procedural mountain might have all the textures and ridges to give it the complexity of a real mountain, but where's the fun it that unless there are lots of things to do on that mountain? Much of the strength of procedural generation is that it is easy to make something massive. If you make a world too massive without putting enough new things to experience in that world, it will just feel empty.
The experience is not consistent. Much of the enjoyment from adventure games is reaching "that one part." Walkthroughs, tutorials, and wikis usually rely on the fact that players are all playing the same game, taking place in the same world. It is more difficult sharing your excitement for a game with others if the experience is so personalized. Imagine sharing a meme about the game if no other player in the world played a game with the same locations, characters, or creatures.

Keeping these problems, and perhaps others you can think of in mind, is there still a way to incorporate procedural generation into a game without ruining exploration? Maybe some certain limited procedural techniques that an adventure game could benefit from but not get in the way of a story?


texts:
I've got a problem with DirectX 12 I cannot figure out by myself. I wrote a small program that should render a triangle onto the screen.
When I executed the application, however, there was no triangle visible. So I launched NVidia's nsight debugger. The weird thing is that the triangle has been drawn to the depth-stencil buffer but not to the back buffer.

If I clear the render target view to light blue it would look like this:

If you need any code snippets please write it in the comments and I will post it.

Thanks in advance


texts: Why should a FPS game use a "floating arms" approach over full body one?

texts:
I've seen many first person shooter games both single and multiplayer using a set of floating arms and a gun instead of using the whole body model.

What is the advantage of floating arms? You are technically doubling the work making two meshes and two animations for each action.


texts: 6DOF camera: inverted yaw and roll when orientation changes

texts:
Whenever I change the orientation of the camera, yaw and roll become inverted (or correct); the strafing, movement and pitch do remain correct however.

Can you tell what is causing this and how to fix it ?

private Vector3 _cameraOrientation;
private Vector3 _cameraPosition;
private Matrix _matrixProjection;
private Matrix _matrixView;

protected override void Update(GameTime gameTime)
{
    var state = GamePad.GetState(PlayerIndex.One);
    if (state.Buttons.Back == ButtonState.Pressed ||
        Keyboard.GetState().IsKeyDown(Keys.Escape))
        Exit();
    if (state.Buttons.Start == ButtonState.Pressed) _cameraPosition = _cameraOrientation = Vector3.Zero;

    var right = state.ThumbSticks.Right;
    var left = state.ThumbSticks.Left;

    // get position/orientation deltas from gamepad
    var position = new Vector3
    {
        X = left.X,
        Y = state.Buttons.A == ButtonState.Pressed ? -1 : state.Buttons.Y == ButtonState.Pressed ? 1 : 0,
        Z = -left.Y,
    };
    var orientation = new Vector3
    {
        X = -right.Y,
        Y = -right.X,
        Z = state.Buttons.X == ButtonState.Pressed ? -1 : state.Buttons.B == ButtonState.Pressed ? 1 : 0
    };

    // update position according orientation
    _cameraOrientation += orientation;
    var cameraReference = Vector3.Forward;
    var cameraRotation =
        Matrix.CreateRotationX(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.X))) *
        Matrix.CreateRotationY(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.Y))) *
        Matrix.CreateRotationZ(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.Z)));
    _cameraPosition += Vector3.Transform(position, cameraRotation);

    // update matrices
    var cameraPosition = _cameraPosition;
    var cameraTransformedReference = Vector3.Transform(cameraReference, cameraRotation);
    var cameraTarget = cameraPosition + cameraTransformedReference;
    var cameraUpVector = Vector3.Transform(Vector3.Up, cameraRotation); // Vector3.Up;
    _matrixView = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUpVector);
    _matrixProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45),
        _graphics.GraphicsDevice.Viewport.AspectRatio, 0.01f, 100000f);

    base.Update(gameTime);
}


texts: Is there a way to use ScreenCapture.CaptureScreenshot and exclude specific gameobject oui from the captured screen in runtime?

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

public class HiResScreenshots : MonoBehaviour
{
    public int resWidth = 1920;
    public int resHeight = 1080;
    public SaveLoad saveLoad;

    public static string ScreenShotName(int width, int height)
    {
        return string.Format("{0}/Saved Screenshots/screen_{1}x{2}_{3}.png",
                             Application.dataPath,
                             width, height,
                             System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
    }

    void Update()
    {
        if (Input.GetKeyDown("k"))
        {
            var filename = ScreenShotName(resWidth, resHeight);
            var directory = Path.GetDirectoryName(filename);
            Directory.CreateDirectory(directory);
            ScreenCapture.CaptureScreenshot(filename);

            string fn = Path.GetFileNameWithoutExtension(filename) + ".savegame.txt";

            StartCoroutine(saveLoad.SaveWithTime(directory,Path.GetFileNameWithoutExtension(filename) + ".savegame.txt"));
        }
    }
}

I'm pressing the K key once and it's taking a screenshot of the game view window and save it as png to the hard drive.
For example :

Let's say I want to exclude from the captured screen the left ui element or maybe only to exclude the cube or maybe to exclude both from the captured screen.
The idea to make some kind of List of objects mixed with ui's that I will not want to be in the saved screenshot/s.


texts: Pygame fails on KEYDOWN with Russian keyboard layout

texts:
When I press a keyboard button on a keyboard with a Russian layout, my application pygame game crashes with this message:

  UnicodeEncodeError: 'ascii' codec can't encode character '\u0444' in position 40: ordinal not in range(128)

This is my code:

 event = pygame.event.poll()
 if event.type == KEYDOWN:
    print(event)

(I pressed the latin 'a' key.)

Pressing keys in the English layout works fine.

I tried changing the event.type == KEYDOWN to event.type == KEYUP: Everything works, but then I cannot access the event.unicode field to get the pressed key.

How do I get KEYDOWN events to work with any keyboard layout?

Python version 3.2


texts:
I have a co-routine which is heavily reliant on calling itself to get the task done. I have tested it and the code works fine, the problem is that the co-routine will return every time that it enters itself recursively.

IEnumerator test(arg1, arg2)
{
    // I want to pause here
    yield return null;

    // I don't want to pause on any of these
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
}

In the example above I have a yield return at the top that is hit and pauses the co-routine, thats fine. Then there are the calls to itself below which also pause the co-routine. How do I avoid pausing the co-routine on the recurcive calls?


texts: Convert large range of numbers to a smaller scale

texts:
What is a good formula to use in order to relate two different scale distances to each other? For example, I have a camera that can have a minimum size of 2 and a maximum of 10. I would like the camera to zoom proportionally with the mouse distance from an object.

The problem is the distance is returned in terms of pixels (e.g. 500px) and I'd like to transform that into a relative value between 2 and 10. What's the best way to do this?

Thanks


texts: Anyway to change the property of a existing animation to another type?

texts:
The title pretty much says it all. Take this rather simple animation

I would like to reuse this same animation in a UI element but  for that I have to animate the Image component and not the sprite. Is there a way to copy over the keys or edit the animation somehow so that the property is a Image.sprite ?


texts: How can library classes access SpriteBatch?

texts:
I have a spritebatch in my primary game component in a game project:

public class GameRoot : Game
{
    private SpriteBatch mySriteBatch;
    public SpriteBatch MySpriteBatch
    {
        get { return mySpriteBatch; }
        set { mySpriteBatch = value; }
    }

I wish to access MySpriteBatch in a library class:

    public override void Draw(GameTime gameTime)
    {
        sprite.Draw(GameRoot.SpriteBatch, gameTime);

This does not work since GameRoot is derived from Game, which is passed to the class,  and is not known in the library project.

How do I resolve this?


texts:
I did use this...and when i changed Screens it gave me this error : Collection was modified; enumeration operation may not execute.

foreach(var screen in ScreenList)

Inside Base Screen

  public void HideScreen()
    {
        Enabled = true;
        Visible = true;
        alpha = 0;
        fade = Fade.Out;

    }

    public void Show()
    {
        Enabled = true;
        alpha = 1;
        fade = Fade.Out;
    }

And in Screen manager

 public static void ChangeScreen(BaseScreen CurrentScreen, BaseScreen TargetedScreen)
    {
        TargetedScreen.HideScreen();
        AddScreen(CurrentScreen);
        RemoveScreen(TargetedScreen);
        CurrentScreen.Show();
    }


texts: How to calculate a direction that will turn a parent so that a locally-rotated child is faced in a given direction?

texts:
Imagine an old sailing ship with cannons: they're pointed out at 90° angles from the ship's hull, so in order to fire them, you have to turn the whole ship so that the cannons are pointed at the target. I'm hoping to figure how to calculate "where to point the ship so that the cannons are aimed correctly," but for any possible cannon-angle (not just 90°) in 3D space.
I'm an experienced dev but a total 3D newb, so this vector stuff is wrinkling my brain. This is what I have right now, calculated from the child's (cannon's) gameObject:
Vector3 directionToAim = (transform.localRotation * (transform.position - target.position)).normalized;
It's working for side-facing weapons (like the sailing ship), but for forward-facing weapons it turns the parent in the opposite direction, directly away from the target.  If I invert it to (target.position - transform.position) the forward-facing weapons work fine, but the side-facing weapons face the opposite way.
Also, my vague understanding is that it's better to use Quaternions for this, rather than Vector3, is that right? Can someone help me grasp how these parent/child rotations can be calculated?


texts: AI to help player by suggesting upgrades

texts:
Suppose I'm creating a racing game.. I would like to implement an awareness system AI, that will suggest to the player that he can buy that booster or some other upgrade, .. etc. How should I start implementing that? A FSM ? A decision tree ?

Suppose that I have variables like, how many crashes, how much is the damage, how many gates I have passed, .. etc how would I use those variables then to say for example you need to buy that stuff?


texts: Why do we refer to a "model view" matrix and not a "viewprojection" matrix?

texts:
Why there is a model-view matrix, but not a view-projection matrix?

A view-projection matrix would make much more sense to me, since every entity in the scene has his own position and therefore its own model-matrix, but there is only one camera, so you could just precalculate the view-projection matrix and then use this matrix to multiply it with every models model-matrix to get every models MVP-matrix. Am I wrong?


texts: How do I find actors in an area on a poly-precise basis?

texts:
Ok, I've been asking various questions and getting some good answers, but I think I need to rethink my method, so I'll describe the problem.

I have a player who has a big blue box in front of him. This box shows which KActors will be pushed when he pulls the trigger:

Currently, the blue box spawns a descendant of Actor which checks collision to see which KActors are touching it:

foreach Owner.TouchingActors(class'DynamicSMActor', DynamicActorItt)
{
      // do stuff
}

The problem is, if you check for touching between Actors and KActors, it looks like it does a plain axis-aligned bounding-box collision. The power will push the box on the lower right, when it's clear it's not touching the blue box.

How should I do this properly? I just need a way to find out which KActors are touching that area, on a poly-by-poly level. These collisions are only done with rectangular boxes and simple sphere collision; we are aware of the potential for performance issues with complex objects and poly-collision.

I've tried making the collision checker a KActor, but it doesn't report any TouchingActors.

This issue is causing us trouble in a lot of other places as well. So solving this problem is a core issue in our game.


texts:
I have a rectangular grid with obstacles and food items on certain tiles. There are also a few storage bins. Each food item gives 10 food. How can I find the shortest path that will allow me to collect 30 food and bring it back to any storage bin ?

I don't think I can use Dijksra class of algorithms because it does not account for a state (food carried) during the pathfinding.


texts: What are examples of games with "minimalist" models/art assets

texts:
When teaching game development, my student's obsess about building realistic or complex art/models/animation. And spending wayyy to much time trying to get accurate collision detection between two 3D models [despite my best efforts]

However I would like them to spend more time thinking about developing the game mechanics, interaction and game play.

I'm looking for some games where the visuals are simple but have good game play.

Things I am thinking about are Cubes' vs Spheres or Impossible Game.

What are more examples of visually simple (preferably 3D) games to help inspire my students?


texts: Dragging text element into Text variable unity 4.6

texts:
So I was trying to make a UI element to keep score in a unity (4.6) project and I'm having trouble assigning the 'Text' element to the Text variable.

So I have the text element with the script attached to it. At the moment the script is empty except from some variables being created, here it is:

using UnityEngine;
using UnityEngine.UI;

public class TextController : MonoBehaviour {

public Text text;
public int score1, score2;

// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {
    //text.text = "a" + "";
}
}

In the unity UI the Text variable shows but it is empty, and it will not let me drag the 'Text' object from the hierarchy into the variable box. It shows the outline like its going to accept it but remaing 'None (Text)' when I release the click. I tried importing an already working UI from another project into this but when I added it to the hierarchy it removed the text element again (just for reference the text worked perfectly in the other project).

Also a screenshot of the hierarch just in case:

Is there a problem with the scipt or the prject or have I messed something else up?

Edit:

Clicking the circle next to the text variable brings up the window to select the element. Mine shows up without anything in it. I expect it to show the text object I have made.


texts: Quaternions, Axis Angles and Rotation Matrices. Which of these should I use for FP Camera?

texts:
After 2 weeks of reading many math formulas and such I know what is a Quaternion, an Axis Angles and Matrices. I have made my own math libary (Java) to use on my game (LWJGL). But I'm really confused about all this.

I want to have a 3D first person camera. The move (translation) is working fine but the rotation isnt working like I need. I need a camera to rotate arround world Axis and not about its own axis. But even using Quaternions, this doesnt work and no matter how much I read about Euler Angles, everybody says to me dont touch on it!

This is a little piece of code that i'm using to make the rotation:

    Quaternion qPitch = Quaternion.createFromAxis(cameraRotate.x, 1.0f, 0.0f, 0.0f);
    Quaternion qYaw = Quaternion.createFromAxis(cameraRotate.y, 0.0f, 1.0f, 0.0f);

    this.multiplicate(qPitch.toMatrix4f().toArray());
    this.multiplicate(qYaw.toMatrix4f().toArray());

Where this is a Matrix4f view matrix and cameraRotate is a Vector3f that just handle the angles to rotate obtained from mouse move. So I think I'm doing everything right:

Translate the view Matrix
Rotate the Move Matrix

So, after reading all this, I just want to know: To obtain a correct first person camera rotate, I must need to use Quaternios to make the rotations, but how to rotate around world axis?

EDIT:

OK, i'm following @Sean Middleditch solution and this should be good, but I think i've missed something...here is the code:

public Matrix4f getView() {
    if (!viewChanged) return viewMatrix;
    if (position == null) position = Vector3f.createEmpty();
    if (rotation == null) rotation = Vector3f.createEmpty();

    viewMatrix = Matrix4f.createIdentity();
    viewMatrix.rotate(rotation);

    Vector4f forward = Vector4f.multiplicate(viewMatrix, new Vector4f(0, 0, -1, 0));
    Vector4f up = Vector4f.multiplicate(viewMatrix, new Vector4f(0, 1, 0, 0));
    Vector4f right = Vector3f.cross(forward.toVector3f(), up.toVector3f()).toVector4f();

    viewMatrix = new Matrix4f(new float[]{
            right.x,                                        up.x,                                       -forward.x,                                     0,
            right.y,                                        up.y,                                       -forward.y,                                     0,
            right.z,                                        up.z,                                       -forward.z,                                     0,
            -Vector4f.dot(right, position.toVector4f()),    -Vector4f.dot(up, position.toVector4f()),   -Vector4f.dot(forward, position.toVector4f()),  1
    });

    setViewChanged(false);
    return viewMatrix;
}

Everything seems to be right, but the "Camera" is rotating now over the origin axis...and I think the problem is because I didnt understand the following:

  construct a regular rotation matrix, and then multiply the standard
  camera vectors by that matrix

Thanks for reading it.

Best regards,

Afonso Lage


texts: I'm trying to open one of my assets in unity via my browser, but when I click open in unity it opens the 2017 version, when I want to add it to my newest one.  How do i get this to work?  (I need the 2017 version, so deleting it is not an option.)


texts: Circle vs. Rect Collision accuracy problem

texts:
The blue ball is dynamic and is supposed to bounce off the walls, as well as the rectangle. Currently, the green rectangle is adding an invisible line to the scene, which doesn't let my ball go where I want it to. You can see the issue on the picture below and also see my source code.

Source code for dynamic circle vs. stationary rectangle collision:

public void collisionRect() {
                double dx = Math.abs(circle1.getLayoutX() - rect1.getLayoutX());
                double dy = Math.abs(circle1.getLayoutY() - rect1.getLayoutY());
                double rect1XRadius = rect1.getWidth() / 2;
                double rect1YRadius = rect1.getHeight() / 2;

                boolean xWalls = dx <= rect1XRadius;
                boolean yWalls = dy <= rect1YRadius;

                if (xWalls) { //if the ball hits any of the X walls
                    c1SpeedX = c1SpeedX * -1; //Invert direction of X
                }
                if (yWalls) { //if the ball hits any of the Y walls
                    c1SpeedY = c1SpeedY * -1; //Invert direction of Y
                }

            }

I don't understand where I've made a mistake and how I can make my code work. Source code examples will be greatly appreciated! Thanks.


texts: How do I fairly distribute new powerful cards to players in a collectible card game?

texts:
I'm writing a game in which users start with a few cards. They use those cards to play against other players. The winner can steal a card from the other player.

The aim is to get more/different/rare/higher-powered cards.

If everyone starts with 10 low-powered cards, how would anyone ever get higher powered cards? They'd just be playing against people who have the same type of cards as them.

How do you fairly distribute these more powerful cards among players?


texts: I'm working on an ARG which will be implemented mostly through a standard website. I'd like to give some of the images on the site steganographic content (hidden content stored in an image, e.g. an 8 color image of the same dimensions stored as even and odd color values in the pixels). Technologically, this is fairly easy to do. However, I'm having trouble figuring out a subtle way to hint at the presence of this content. The effect itself is invisible to the naked eye, and nobody just randomly checks for this kind of thing. What can I do to draw players' forensic attention to these images, while still maintaining an amount of subtlety (i.e. something that doesn't make it glaringly obvious)?


texts:
I'm trying to use cyrillic(Russian) letters in libgdx Scene2d. I drop default.fnt and default_0.png (generated with BMfont) into folder assets of my Android project (other files such as uiskin.atlas,uiskin.json,uiskin.png are taken from libgdx examples).

main code:

    skin = new Skin(Gdx.files.internal("uiskin.json"));
    Label label1 = new Label("QWERTYqwertyЙЦУКЕНйцукен",skin);

uiskin.json:

    {
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } },
com.badlogic.gdx.graphics.Color: {
    green: { a: 1, b: 0, g: 1, r: 0 },
    white: { a: 1, b: 1, g: 1, r: 1 },
    red: { a: 1, b: 0, g: 0, r: 1 },
    black: { a: 1, b: 0, g: 0, r: 0 },
},
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
    dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } },
},
com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
    default: { down: default-round-down, up: default-round },
    toggle: { down: default-round-down, checked: default-round-down, up: default-round }
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
    default: { down: default-round-down, up: default-round, font: default-font, fontColor: white },
    toggle: { down: default-round-down, up: default-round, checked: default-round-down, font: default-font, fontColor: white, downFontColor: red }
},
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
    default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
    default: {
        font: default-font, fontColor: white, background: default-select,
        scrollStyle: default,
        listStyle: { font: default-font, selection: default-select-selection }
    }
},
com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: {
    default-vertical: { handle: default-splitpane-vertical },
    default-horizontal: { handle: default-splitpane }
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
    default: { titleFont: default-font, background: default-window, titleFontColor: white },
    dialog: { titleFont: default-font, background: default-window, titleFontColor: white, stageBackground: dialogDim }
},
com.badlogic.gdx.scenes.scene2d.ui.ProgressBar$ProgressBarStyle: {
    default-horizontal: { background: default-slider, knob: default-slider-knob },
    default-vertical: { background: default-slider, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
    default-horizontal: { background: default-slider, knob: default-slider-knob },
    default-vertical: { background: default-slider, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
    default: { font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
    default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor }
},
com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
    default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
    default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font: default-font }
},
com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle: {
    default: { background: default-pane, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Tree$TreeStyle: {
    default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection }
},
com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle: {
    default: {
        label: { font: default-font, fontColor: white },
        background: default-pane
    }
},
}

and get such result:

Where can be the problem?


texts: How does a "debug console" handle dependencies/access objects?

texts:
I'm trying to get my head around how to create a debug console and have a hard problem to figure out how it access different objects in my game.

Say for example I want the console to be able to:

Add new enemies on current map -> This requires access to the current map or some entity service
Add a new component to a current entity -> This requires access to some current entity list.
Change settings -> This require access to some settings service/manager
Change map -> This requires access to some map service/manager
Start a new game event -> This requires access to maybe some maps event handle.
etc

It seems like this list may just grow and grow with new commands with new dependencies and I wonder how you structre this? How does for example the Half-life console work?

It feels a bit rough to just have something like this:

var console = new DebugConsole()
console.AddCommand(new AddEntityCommand(entityService))
console.AddCommand(new SettingsCommand(settingsService))
etc

But maybe that's the way to do it?


texts: Convert point to its barymetric coordinates

texts:
I'm making a 2.5D game engine (in JavaScript) and I'm trying to get it to detect whether a block is under the cursor. This would be a simple task were it restricted to single-level isometric coordinates, but instead it's supposed to support isometric worlds, trimetric worlds and well, any projection angle really, in addition to it being multi-level (tiles can be stacked on each other up to an arbitrary limit). Almost all the conditions are arbitrary, but I've managed to narrow the problem to this, for now:

I need to know whether a point is inside a hexagon:

What I've set up so far is a bit hackish, I'm checking whether the point is inside the bounding rectangle first to drop out the most obvious cases. Next, I'm checking whether it's inside the rectangle formed by the points ACDF, another easy check. Now the hard part is that I need to check whether the point is inside the triangles. That's pretty straightforward if you have the barycentric coordinates, but I seem to have lost all the knowledge of how to obtain them.

Do take into account that while the inner rectangle is always a rectangle, the triangles might not be equal-sided. Bonus points if there's an optimization to be made because the bottom (or top, respectively) of the triangle is flat.


texts: How do I apply Ambient Occlusion in Forward Rendering to the ambient term only?

texts:
I want to integrate Ambient Occlusion into my rendering which is a forward renderer.
How do I apply Ambient Occlusion to the ambient term only and thus not as a "post process"  over the entire image (i.e. frambuffercolor * ambient occlusion)?


texts: Subtract a circle on a rectangle - OpenGL

texts:
I am writing a game using GLFW, GLEW, GLM and Bullet3 in C++. Its a Maze with holes. I am doing the floor with rectangles (wich is 2 GL_TRIANGLES).

I want to make some woles (circles), to the ball fall out of the board. What the best way to do that? How can I subtract a circle to the floor? And add the shape to the Bullet3?

Thanks


texts: Visual Studio can't handle my unity scripts

texts:
I have created a new project in Unity 2018.3.4f1 with Visual Studio Community 2017.
I can't edit scripts properly in Visual Studio because of a bunch of errors related to .net framework. How can I fix these issues?


texts: Any resources for how to read image files

texts:
I'm learning opengl and I'm the kinda guy who likes to write things from scratch and I was searching for how I can read image files data to create my own image importing library to use for textures but I couldn't find anything useful except reading a bmp file. Can you recommend any resources that might help me?

Thanks in advance


texts: How do idle games handle such large numbers?

texts:
Just wondering how games such as Tap titans and Cookie Clicker handle such large numbers.

I am trying to implement an idle game however the largest number format supported by C# is decimal.

I am looking to support up to 10^500; that needs to be floating point

How could I handle this?

P.S. it needs to be cross platform i.e. pc, mac, ios, android and compatible with Unity


texts: Software Design/Modelling method and tool for games?

texts:
I've heard that UML is a great modelling language for software design. However, for software, such as game, that will certainly encounter major changes during the development, I doubt that UML will work effectively.

What are the common ways or models that the game programmers used? and is there any recommended tools for game designing process?


texts: How can I implement an infinite parallax background like in Slither.io?

texts:
I am trying to replicate the endless scrolling of slither.io but, I can't figure out how to implement it. Since the players can move to any direction and the background needs to be available during player's displacement.

All the parallax background scrolling tutorials show only moving on one axis, either x or y, but my case it could be to any possible direction like an arrow compass.

Can some one point me in the right direction about how I can implement this effect?

EDIT: User can move to any possible direction like an arrow in a compass.

Custom Camera Controller that follows the player

public class CameraController : MonoBehaviour {

    public GameObject Player;

    private Vector3 offset;

    // Use this for initialization
    void Start () {

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

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

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


texts:
I am trying to create a inventory screen / system for my game. And I don't know how it will work. I'm creating it in unity. I was thinking of making a database of all items and a database of items in inventory. However unity has no database function. Another problem would be using a web database. Every single player can't have their own database, it would be overkill.

I haven't started writing any code for the inventory but only planning for it. The type of inventory system I am planning is similar to skyrim. List on left and stats for items on the right.


texts:
I'm building an inventory system for a MMORPG game that can possibly contain massive numbers of players (~20.000). Is it smart to make an InventoryTable where each row contains only one item, or should I make one big VarChar column that contains all of the information about all Items for a player.

A player has about 200 items.

And every item has about 20 additional pieces of information: ItemID, Amount, ...

So this big varchar column can be something like 15000 chars long.

Here are some basic attributes:

What will be faster?
 - Reading maybe 200 lines from a big table for each player
 - Or one big line for every player and serialize it in my server.

Is use a MSSQL database with ODBC.


texts: In terms of Game Design, is the definition more of designing the ENTIRE game, or can it be limited to contributing to the artwork?

texts: I am a person who desires a job in the artwork development of a video game, but the exact term for the general career often confuses me. What I want to do is Character Design, but what general career does it fall under in terms of video games? Is the overall concept Game Design, or is it just Illustration? I get confused that Game Design is just creating the ENTIRE game from the top of your head and not just a specific area of the development, like the art. Am I wrong? Does Game Design work for both the idea and the artwork, and can the term be separated between the two? A helpful answer would be much appreciated.


texts: Does a pong clone called "Ping" infringe on any copyrights or trademarks?

texts:
Long story short, I made a retro Pong clone and submitted it to the App Store as my first app. It survived for a bit, but I eventually received a message from Atari tell me to remove it. There was nothing more than that, I just took it down, and they made no other demands. Since then, it has remained removed.

I have become a much better programmer now and would now like to re-create my original app and upload it again. However, I'm afraid that something of the sort would happen again. Is remaking the game itself against any laws? If not, would using the name "Super Ping" instead of "Super Pong" be legal?


texts: TileBased Game: Blitting Hero or Sprite?

texts:
So my environment is all set up and now I'm working on the movement physics of my character. I used blitting to copy over my tiles from a tilesheet. But since they are static, they are only copied over once. And with the Hero (main player character), I figured that I might blit him into his continuously changing position. But now, I'm not quite sure it's necessary?

Is there a real big perfomance-save to copy the Hero sprite into a new position constantly using Blitting, OR, is it fine to just copy it into the game once, and simply move the Hero sprite as a movieclip?


texts: Designing Drops system - How and where chance of drops are defined?

texts:
Just found a related topic but I have different/extended questions

I was wondering how the implement the drop system. I have to start designing the DB model for this so I was wondering whether what I am thinking is a good practice or not.

My game is like "City building" kind of browser based game (Flex/Flash app) with PHP and MySQL in the backend. In my game, like in any other games, there are chance based drop rate. I want to design the drop system such a way that I can easily configure

What item(s) can be dropped from which game element
What is the percent chance (probability) of getting a drop (a 100% meaning there will be some drop always)
What percent chance of getting a specific drop. Here I define for each item (if can drop various items) what is the chace of drop, 90% to very frequent, 5% to very rare

I am wondering how the probability is determined? It might sound very noobish but just want to confirm does it mean roll a random number and compare with the odds we defined?
If I am not wrong this is good for determining "how much to drop" but not for "what to drop"

Example: If we say drop 1-10 coins or 20-50 coins. I will simply call a random() function and generate a random numbed from the desired range.

Now for other example: Drop one of Bullets (95%), Empty Gun (4%), Loaded Gun (1%)

If I roll a random number range from 1-100 and compare with probability I defined

so, a number between 1-95 drops bullet, and a number between 96-99 drops empty gun and a loaded gun when it generates 100?

Is this how it has to be done? or is there a better way?

Update:

Removed 2nd question about hack safety


texts: How to simulate the object cutting with a lathe, similar to what's done in the CRAFT: Work VR Shop app?


texts: algorithm to change the center of the image

texts:
I need and algorithm in Java if possible to change the center of the image when scaling.What is happening to me is represented in the first image:
when I scale the image the image scale according to the center point of the image, what I want to do is on image2, I want to create a point A and make the image scale using that point on the horizontal line (y=540).

I have the screen size(1920x1080) the horizontal line y=540, the length and width of the rectangle, image_X=0,image_Y=0 will put the center point o x=0 and y=0, (on the image example x=1000)

Every time I do scale_image=2 the image is reduced to half the size, which is fine but it does that using center point. What I want to do is to adjust image_Y so it uses point A as the new center.


texts: How to change a class's variables at runtime without knowing in advance which class's variables to change?

texts:
I am creating a nuclear war simulation game a bit like Defcon if any of you have played that. In the game you can chose one of several regions to play as and in my game I want each region to have different stats for their weapons and I want these stats to be changeable throughout the game if a region decides to develop a particular weapon for instance.

So I have a generic Weapon class that has a damage, a cost, a range etc. I then have different types of Weapon all stored in a WeaponArsenal class (ICBM, MRBM etc). Each region has different values for each of these and it needs to be possible to change them when the player or AI decides to upgrade a weapon.

Of course I can't predict which region the player will pick and therefore can't determine which regions will be AI controlled and which will be the player region. At the moment each available region is a class which has its own values for its weapons through an object but I don't know how I can chose which class to use for the player at run time without very repetitive if statements.

How can I therefore allow the player to upgrade their selected region's weapons without knowing their chosen region and calling a function explicitly?

Should I make a pointer to an object and point it to a different class's object depending on input at the start and then use this object pointer to change a region's variables throughout the game, and is having each region be its own class the best way of setting the game up? I have heard that making each region a map might make things easier but do not now how I would implement this. Which data structure should I use and how should I implement it?

The weapon class:

class Weapon
{
private:
    int count;
    int damage;
    float cost;
    int range;

public:
    void upgradeRange(Weapon wep, float p) {
        float percentDecimal = p / 100;
        float modifier = percentDecimal + 1;
        wep.range * modifier;
    }
    // more functions for upgrading each stat
    // more functions for setting and getting each stat

}

The WeaponArsenal class:

class WeaponArsenal
{ /* Weapon Types */
public:
    Weapon icbm;
    Weapon mrbm;
    Weapon srbm;
    Weapon bomb;

    WeaponArsenal() {

        // DEFAULT ICBM VALUES
        icbm.setCount(0);
        icbm.setCost(120);
        icbm.setRange(8000);
        icbm.setDamage(80);

        // DEFAULT MRBM VALUES
        mrbm.setCount(0);
        mrbm.setCost(100);
        mrbm.setRange(2000);
        mrbm.setDamage(70);

        // DEFAULT SRBM VALUES
        srbm.setCount(0);
        srbm.setCost(80);
        srbm.setRange(800);
        srbm.setDamage(55);
    }
};

A region class:

class Europe
{
private:
    WeaponArsenal arsenal;

public:

    Europe() {
    }
};

Full main.cpp file so far is on Github: